ManagementPath path = new ManagementPath(strComputerName+"\\root\\CIMV2");
ConnectionOptions connection = new ConnectionOptions();
connection.Username = strUser;
connection.Password = strPwd;
ManagementScope scope = new ManagementScope(path, connection);
scope.Connect();连接一直报异常 说存取错误
ConnectionOptions connection = new ConnectionOptions();
connection.Username = strUser;
connection.Password = strPwd;
ManagementScope scope = new ManagementScope(path, connection);
scope.Connect();连接一直报异常 说存取错误
ConnectionOptions connection_wmi = new ConnectionOptions();
connection_wmi.Username = "administrator";
connection_wmi.Password = "";
connection_wmi.Authority = "";ManagementScope scope = new ManagementScope("", connection_wmi);
scope.Connect();
Run dcomcnfg command (via Start menu -> Run dialog) to bring up Component Services window.
Expand nodes: Component Services -> Computers -> My Computer > DCOM Config
Scroll down list, right-click Windows Management and Instrumentation, and select Properties, then "Management and Instrumentation Properties" window will be displayed.
Select the Security tab, then select "Customize" radio button to activate the Edit button, then you will see such two permission options ("Local Access" , "Remote Access") for each account.
Add the ASPNET account, and assign the "Remote Access" permission.
Reboot the server.