Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getin "Access is denied" exception while,
tryin to run a PROCESS on REMOTE MACHINE... User Credentials given


Using C#, WMI, Details about the code,
object[] theProcessToRun = { "calc.exe" };
ConnectionOptions theConnection = new ConnectionOptions();
theConnection.Username = "chester";
theConnection.Password = "";
ManagementScope theScope = new ManagementScope("\\\\" + "192.168.10.15" + "\\root\\cimv2", theConnection);
theScope.Connect();  // TO PUT THIS OR NOT ???
ManagementClass theClass = new ManagementClass(theScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
theClass.InvokeMethod("Create", theProcessToRun);


Whether to PUT theScope.Connect(); ?
Posted
Updated 22-Mar-10 3:21am
v2

The user credential you are using must have the rights to run the process on the machine you are trying.
 
Share this answer
 
Try to set EnablePrivileges[^] to true.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900