JG Vimalan's Blog

It is all about coding!

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))
{
 process.WaitForExit();
}

To run the PsExec.exe from run command the syntax is given below,

C:\Project\psexec.exe \\servername “C:\PROGRA~1\myapp\sample.EXE”

 

Advertisements

September 11, 2012 - Posted by | C#.NET, VS 2010

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: