以下のコードを使用して、2 つのサーバーでコンソール アプリケーションを呼び出す PsExec.exe を呼び出しています。呼び出されたプロセス (コンソール アプリ) の ProcessId を取得できません。
process.StandardOutput.ReadToEnd()); サーバー名のみを提供していますが、完全なコンテンツは提供していません。
リモート サーバー上の PsExec.exe によって生成されたプロセス ID を取得する方法を教えてください。
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:\data\GridWorker\GridWorker.exe 100000";
process.StartInfo = psi;
process.Start();
Console.WriteLine(process.StandardOutput.ReadToEnd());