I am using the below code to invoke PsExec.exe which invokes my console application in two servers, I am not able to grab the ProcessId of the invoked processes (my console apps).
process.StandardOutput.ReadToEnd()); is only giving me the servernames but not the complete content.
Can you please help me to get the process id s generated by PsExec.exe on the remote servers ??
Process process = new Process();
ProcessStartInfo psi = new ProcessStartInfo(@"PsExec.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.RedirectStandardInput = true;
psi.WindowStyle = ProcessWindowStyle.Minimized;
psi.CreateNoWindow = true;
psi.Arguments = @"-i -u Username -p xxxxxx \server1,server2 C:dataGridWorkerGridWorker.exe 100000";
process.StartInfo = psi;
process.Start();
Console.WriteLine(process.StandardOutput.ReadToEnd());