Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to start process from remote machine in c#. I tried by this code but it given error as "Access denied;
C#
var processToRun = new[] { "Message.exe" };
var connection = new ConnectionOptions();
connection.Username = "username"
connection.Password = "password"
var wmiScope = new ManagementScope(String.Format(\\\\                                                                                    {0}\\root\\cimv2","PC_NAME"), connection);
var wmiProcess = new ManagementClass(wmiScope, new ManagementPath(Win32_Process), new   ObjectGetOptions());
wmiProcess.InvokeMethod("Create", processToRun);

exe is located in "E" drive with name "Message.exe". Have any idea how to execute that exe. Please share. Is it is possible without username and password?

Thanks.
Posted
Updated 13-Jun-14 0:13am
v2

1 solution

Hello Sachin,

Looks like a permission issue to me. Please have a look at this KB-317012[^] Article.

Regards,
 
Share this answer
 
Comments
[no name] 13-Jun-14 9:09am    
+5;

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