Actually, it is more likely that this code is executing with the privlages of IUSR_MACHINENAME, IWAM_MACHINENAME, or some other such account. The default behavior when you create a connection object with a 0 object constructor is to instantiate with the credentials of the creating process.
Try something like this ( assuming that the variables strUsername and strPassword have been set to the credentials you want to use; you can hard code these, or pass them in as parameters to the web service ... perhaps from a form on the web page)...
...
ConnectionOptions oConn = new ConnectionOptions();
oConn.Username = strUsername;
oConn.Password = strPassword;
System.Management.ManagementScope oMs = new System.Management.ManagementScope("\\\\" + strComputername + "\\root\\cimv2", oConn);
...
Regards,
Meredith Shaebanyan
|