Programmatically run PsExec.exe
The following code snippet will give you an idea on programmatically (c#) running PsExec.exe. I assume that you have already copied PsExec.exe in your executable path. In the following code snippet I am trying to launch an application in remote server programmatically.
ProcessStartInfo processInfo = new ProcessStartInfo();
processInfo.FileName = “PsExec.exe”;
processInfo.Arguments = “\\servername \”C:\\PROGRA~1\\myapp\\sample.EXE\””;
using (Process process = Process.Start(processInfo))
To run the PsExec.exe from run command the syntax is given below,
C:\Project\psexec.exe \\servername “C:\PROGRA~1\myapp\sample.EXE”
No comments yet.