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)
Try to add domain or computer name before the username (e.g. @"mshome\Samuel").
Not sure if it is denied because the WMI engine isn't listening on the remote machine, or if you have other login/connection issues.
Here's the code I used to connect to my remote machine, and it is working perfectly. Maybe it will help you:
If my domain/login/password trio are accepted, then Connect() will work. Otherwise, Connect() throws an exception. As long as the specified credentials have permission on that machine, you should be off and running.
Are you sure you can make remote WMI connections to accounts without passwords?
There are a number of things such accounts can't do (share files, remote desktop, for example). Try setting a password and see if that makes a difference.