Visual Studio .NET - Remote WMI - Generic Failure [0x80041001]

Asked By Joe Adcock on 27-Jul-06 04:16 PM
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

Need Administrator domain account - Asked By Peter Bromberg on 27-Jul-06 04:39 PM

credentials for the calling code to do this. And, appropriate permissions may need to be set on the target machine as well.
Asked By Joe Adcock on 27-Jul-06 04:54 PM
Hey Peter,
   Thanks for the quick response!  This is being run from a domain administrator account.  It works fro most PCs, but there are certain ones I cannot query.  Other domain admins here can query the ones I cannot, but there are other machines they cannot query that I can.  Weird, huh?  Any other hints?  Thanks again!
Joe

Rebuilding WMI Repository didn't fix either - Asked By Joe Adcock on 28-Jul-06 09:51 AM

Hi,
   I also forgot to mention that rebuilding the WMI repository didn't fix it either.  I didn't think that was the problem, but figured it was worth a try anywhere.  I am pretty sure this would have to be a permissions issue somewhere because the problem follows the username, although it is a domain admin account.  Also, rejoining the PC on the domain didn't fix it either.
Joe
Works when I'm RDPed to the remote system - Robert Praetorius replied to Joe Adcock on 31-Jul-09 03:05 PM
I'm seeing the same error.  Sometimes.  Under the same conditions as the guy near the end of http://forums.windowsitpro.com/web/forum/messageview.aspx?catid=43&threadid=43918&enterthread=y.

Namely, if I'm RDPed into the remote system, the WMI Win32_Product operations go fine.  If I'm not (if I'm only logged into the system initiating the WMI operation) I get the 0x80041001 error.

Another random thought - your example code has a variable named ipaddress.  Do you mean that literally?  Some things work when you give them a host name but not when handed a dotted quad.  Don't know if WMI cares, but it's worth a shot.

rafal replied to Robert Praetorius on 23-Feb-10 04:02 AM
You'll find solution here:http://social.technet.microsoft.com/Forums/en-US/winserverManagement/thread/05205b52-0e43-4ce3-a8b8-58ec4c2edea5