Example #1
0
        public static string GetApp(string appname, string computername)
        {
            RemoteApps App = new RemoteApps();

            App.RemoteApp = appname;

/*            Process p = new Process();
 *          p.StartInfo.UseShellExecute = false;
 *          p.StartInfo.RedirectStandardOutput = true;
 *          p.StartInfo.RedirectStandardError = true;
 *          p.StartInfo.RedirectStandardInput = true;
 *          p.StartInfo.FileName = @"./PsExec.exe";
 *          p.StartInfo.Arguments = @"\\computername cmd.exe ipconfig /all";
 *          p.Start();
 *          string output = p.StandardOutput.ReadToEnd();
 *          string errormessage = p.StandardError.ReadToEnd();
 *          p.WaitForExit();
 *          /*var processToRun = new[] {appname};
 *          var connection = new ConnectionOptions();
 *          var wmiScope = new ManagementScope(String.Format("\\\\{0}\\root\\cimv2", computername), connection);
 *          var wmiProcess = new ManagementClass(wmiScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
 *          wmiProcess.InvokeMethod("Create", processToRun);
 */
            Term term = new Term(appname, computername);

            term.Show();
            return(appname);
        }
Example #2
0
        private void Term_Load(object sender, EventArgs e)
        {
            cmdOutput  = new StringBuilder("");
            cmdProcess = new Process();
            RemoteApps app = new RemoteApps();

            cmdProcess.StartInfo.FileName               = "./psexec.exe";
            cmdProcess.StartInfo.UseShellExecute        = false;
            cmdProcess.StartInfo.CreateNoWindow         = true;
            cmdProcess.StartInfo.UseShellExecute        = false;
            cmdProcess.StartInfo.RedirectStandardOutput = true;
            cmdProcess.StartInfo.RedirectStandardError  = true;
            cmdProcess.StartInfo.Arguments              = @"\\ " + Term.ActiveForm.Text + "cmd.exe";


            cmdProcess.OutputDataReceived += new DataReceivedEventHandler(SortOutputHandler);
            cmdProcess.StartInfo.RedirectStandardInput = true;
            cmdProcess.Start();

            cmdStreamWriter = cmdProcess.StandardInput;
            cmdProcess.BeginOutputReadLine();
        }