Hi all,
I have been having a problem querying WMI on several machines. I am hoping someone here may have a solution, as I am at a loss as to where to continue troubleshooting. The program I am working on is written using VB.net, but the problem lies in WMI itself, so hopefully this is the correct place to post this. The following code works for most PCs in our domain:
[CODE]
Dim objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & IPAddress & "\root\cimv2")
Dim colSoftware = objWMIService.ExecQuery _
("SELECT Name FROM Win32_Product")
Dim objSoftware
For Each objSoftware In colSoftware
If (Not objSoftware.name Is System.DBNull.Value) Then
msgBox(objSoftware.Name)
End If
Next
[/CODE]
However, on a small percentage of PCs in our domain no results are returned from this query. This IS being run from a domain admin account, and I have verified permissions are the same as the computers that are returning the results under the WMI Control under Computer Management. Also, this can be run locally with the same username and will return results from the query.
In troubleshooting, I found that running this query through the WMI command line interface [WMIC] had problems with the same computers, but would actually give an error message as shown below:
[CODE]
C:\>wmic /node:'computername' path win32_Product get name
Node - computername
ERROR:
Code = 0x80041001
Description = Generic failure
Facility = WMI
[/CODE]
I have also found that other domain admins are able to query the "problem machines" without any issue, but they have problems with other computers that I can query. I have also found that if I remote desktop to a problem computer, and then minimize the session, I can run the query without any problems. Weirder still is that I am able to query a "problem machine" without issue If I query at the same time someone else does that has not been having the issues.
This problem follows the username of the person running the query, regardless of where they remotely run the query from. But although my query fails to return results remotely from numerous computers, I can still run it when logged in locally on the problem machines and retrieve results.
Hopefully somebody has overcome this problem before. Thanks for you time and assistance!
Joe