我试图连接到管理范围,如下所示:
ManagementScope scope = new ManagementScope( @"\\mydomain\root\RSOP\Computer"));
scope.Connect();
但如果当前用户不是域管理员,则会引发异常(
Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)
)。一个简单的域用户如何连接到这个管理范围?谢谢.
最佳答案
试试这个…..
ConnectionOptions con = new ConnectionOptions();
con.Username = "Administrator";
con.Password = "Password";
ManagementScope scope = new ManagementScope(@"\\" + strIPAddress + @"\root\cimv2", con);
scope.Connect();