Welcome to MSDN Blogs Sign in | Join | Help

starting a process on a remote machine

Uses your existing credentials, of course, but I wanted to pass along in case others could use this:

ManagementClass processClass = new ManagementClass("\\\\" +

    remoteServer + "\\root\\CIMV2:Win32_Process");

ManagementBaseObject inParams = processClass.GetMethodParameters("Create");

inParams["CommandLine"] = program;

ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null);

Console.WriteLine("Started process id {0} on server {1}",

    outParams["ProcessId"], remoteServer);

 

Also, Juanya Williams (lead on the Passport team) mentions the mgmtclassgen tool which can generate strongly-typed wrapper classes.

Published Saturday, October 30, 2004 10:04 PM by jmanning

Comments

# Starting a Process on a Remote Machine

Saturday, October 30, 2004 11:44 PM by Tech Guru

# re: starting a process on a remote machine

Sunday, October 31, 2004 1:16 AM by Addy Santo
Sweeeeet....

# re: starting a process on a remote machine

Sunday, October 31, 2004 8:29 PM by Jack Mayhoff
Oh starting a process on a remote machine is easy. Just get off yer arse and walk over to it and start it. Easy huh.

# starting a process on a remote machine

Wednesday, November 03, 2004 4:51 PM by dotRob
Anonymous comments are disabled
 
Page view tracker