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.

Comments (4)
  1. Jack Mayhoff says:

    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.

Comments are closed.

Skip to main content