I want to connect to remote PC running Windows 7, from another PC using ManagementScope on a local network.
On remote PC I've created a new user account "Samuel" without password and set as administrator.
ConnectionOptions options = new ConnectionOptions();
options.Username = "Samuel";
options.Password = "";
ManagementScope scope = new ManagementScope("\\\\192.168.0.2\\root\\cimv2", options);
scope.Connect();
The Error I get:
Access is denied. (Exception from
HRESULT: 0x80070005 (E_ACCESSDENIED))
Update:
After setting password for the use, I get new error:
The RPC server is unavailable.
(Exception from HRESULT: 0x800706BA)
Best Answer
Maybe it's the missing 'EnablePrivileges':
From MSDN (ConnectionOptions.EnablePrivileges Property):
Edit: If it doesn't work, try setting the ImpersonationLevel to 'Impersonate':