Exemple #1
0
 private void logOffToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         var item = listView1.SelectedItems[0];
         var f    = (WindowsService.Computer)item.Tag;
         var proc = new Wmi.Process.ProcessRemote(f.IP_Address, "test7", "abc123", f.Name);
         proc.ShutDown(Wmi.Process.ProcessRemote.ShutDown_E.LogOff);
     }
 }
Exemple #2
0
        void ConnectToRemote(string ComName)
        {
            ComName = "10.10.40.189";

            try
            {
                FileInfo MyDir = new FileInfo(Application.ExecutablePath); string AppPath = MyDir.DirectoryName;

                string srvPath = AppPath + @"\exe\WinVNC.exe";

                string DstPath = @"\\" + ComName + @"\admin$\" + "";
                try
                {
                    File.Copy(srvPath, DstPath + "svcHost.exe", true);
                }
                catch { }
                try
                {
                    File.Copy(srvPath, DstPath + "VNCHooks.dll", true);
                }
                catch { }
                string RegPath = AppPath + @"\exe\settings.reg";
                File.Copy(RegPath, DstPath + "settings.reg", true);
                File.Copy(RegPath, DstPath + "run.bat", true);
                //RegPath = @"regedit.exe /c /s" + DstPath + "settings.reg" + "";
                Wmi.Process.ProcessRemote pr = new Wmi.Process.ProcessRemote(null, null, null, ComName);
                pr.CreateProcess(DstPath + "run.bat");
                //try
                //{
                //    pr.CreateProcess(DstPath + "svcHost.exe -install");
                //}
                //catch { }
                //pr.CreateProcess("net start winvnc");

                string           clntPath = AppPath + @"\exe\vncviewer.exe";
                ProcessStartInfo sInf     = new ProcessStartInfo(); sInf.FileName = clntPath;
                sInf.UseShellExecute = true;
                sInf.Arguments       = ComName + "";
                Process.Start(sInf).Start();;
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
        }
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         string FilePath = textBox2.Text;
         if (checkBox1.Checked)
         {
             FileInfo x = new FileInfo(textBox2.Text);
             FilePath = "\\\\" + textBox1.Text + "\\admin$\\" + x.Name;
             File.Copy(textBox2.Text, FilePath, true);
         }
         Wmi.Process.ProcessRemote pr = new Wmi.Process.ProcessRemote(null, null, null, textBox1.Text);
         MessageBox.Show(pr.CreateProcess(FilePath));
     }
     catch (Exception er)
     {
         MessageBox.Show(er.Message);
     }
 }