We have a .NET application that uses WMI to gather a wide range of information on machines throughout a network, such as reading the Win32_NTLogEvent to see if Symantec Antivirus has written anything. The queries work fine, but after repeatedly running a WMI query "Generic Failure" errors will start coming back. This happens very consistently after approx. 125 calls. Rebooting the machine that we are running the WMI query against, always fixes the error... that is until the next 125 queries are run.
It appears that the repository is fine and we can't locate any log file size issues.
More Info - Ran WMIDiag after getting the error and found -
25607 13:55:38 (1) !! ERROR: WMI ENUMERATION operation errors reported: 2 ERROR(S)!
25608 13:55:38 (0) ** - ROOT/CIMV2, SubClassesOf, '*', 0x80041006 - (WBEM_E_OUT_OF_MEMORY) Not enough memory for the operation.
25609 13:55:38 (0) ** MOF Registration: 'C:\WINNT\SYSTEM32\WBEM\SNMPREG.MOF ' 25610 13:55:38 (0) ** - Root/CIMv2, InstancesOf, 'Win32_PerfFormattedData_PerfProc_Thread', 0x8007000E - Not enough storage is available to complete this operation..
25611 13:55:38 (0) ** MOF Registration: 'C:\WINDOWS\SYSTEM32\WBEM\WMI.MOF'
Anyone ever see this? Ideas?
We saw the "Generic Failure" error so many times with different WMI queries that we basically came to the conclusion that WMI isn't stable enough to use for anything other than raw administration. Our only solution after months of messing around was to pull all the WMI calls and find replacements in pure API calls. They would always work for a while, and then fail with "Generic Error" (I know this isn't an answer, but it is a shared experience and if anyone has an answer I would be very happy to hear about it).
I believe we have found the issue. To simplify some of our queries we were adding something like 1=1 in the where clause to ease the building of the query. Removed the constant=constant and the one query I was testing with went from 40 seconds to .4 seconds and has run over 10,000 times without generating a generic failure (WBEM_E_OUT_OF_MEMORY).
Windows Remote Management (WinRM) may overcome all these problems. WinRM is the Microsoft implementation of WS-Management Protocol, a standard Simple Object Access Protocol (SOAP)-based.
I had a similar problem to this when attempting to uninstall / Install software on remote machines via WMI.
The problem arises where your roaming profile is present on the target machine. This can be due to having previusly queried the WMI on the target machine.
I dont know if this is the same issue, but I have to had to put a check in place to see if my profile is in the Documents and Settings folder on the target machine before i attempt to uninstall the software.
I'm assuming that when your running your query's its creating your profile on the local machine.
I got a Generic Failure message any time I had attempted to uninstall software on a machine I'd previously worked on remotley.
Now i ensure that before I attempt to uninstall / Install software components remotley, that my profile is removed form the target machine. I've had no problems since.
Hope this helps anyone.
User contributions licensed under CC BY-SA 3.0