Start an application in remote machine using WMI(C#)

  • Thread starter Thread starter Prakashvimal
  • Start date Start date
P

Prakashvimal

Guest
I am trying to start an application in another machine which is in the same network using following code:

var processToRun = new[] { "notepad.exe" };
var connection = new ConnectionOptions();
//connection.Impersonation =
//System.Management.ImpersonationLevel.Impersonate;
connection.Username = "user";
connection.Password = "pass";
var wmiScope = new ManagementScope(String.Format("\\\\{0}\\root\\cimv2", "192.168.0.1"), connection);
wmiScope.Connect();
var wmiProcess = new ManagementClass(wmiScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
wmiProcess.InvokeMethod("Create", processToRun);


This code is running fine without any error, but it is still not starting the notepad in the another machine.

I also checked in the task manager process list, its not there.

So i am not getting where i am doing mistake. Also Please let me know of there is any other approach.

Thanks in advance :)



chandra

Continue reading...
 
Back
Top