I have two XP Pro SP3 machines. I disabled the firewall in both. The workgroup name is WORKGROUP. I have an administrator account with identical username/password in both. My code to connect is the following:
ConnectionOptions options = new ConnectionOptions();
options.Username = myUsername;
options.Password = myPassword;
options.Authority = "ntdlmdomain:WORKGROUP"; // Commenting this or not makes no difference
ManagementScope scope = new ManagementScope(String.Format("\\\\{0}\\{1}", hostname, Namespace), options);
scope.Connect();
I always get a System.UnauthorizedAccessException
with the text:
"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
The above code works between two machines that are part of the same AD domain. What am I doing wrong?