Here’s an issue that some of our WMI enthusiasts have been seeing in the field. When remotely querying the Win32_Product class to determine what software is installed on a Windows XP or Windows Server 2003 system, a “Generic Failure” (0x80041001) error is returned. If the same query is run locally on the target system, it works just fine. So what gives?
I’m glad you asked. When querying the Win32_Product class, the WMI provider DLL for Windows Installer (MSIPROV.DLL) is loaded into a WMI Provider Host process (WMIPRVSE.EXE) and this provider enumerates the software installed on the system. When the provider detects that a “Per-User” install has occurred, it checks the current user’s profile as well. This is easy when you run the query locally, because your profile registry hive is already loaded into memory. Running this query remotely is a different story.
The “Generic Failure” problem occurs during a remote query because the profile for the user running the query cannot be successfully parsed on the remote system. Some installation packages default to Per-User, and some don’t ask. If your user account was logged in during one of these installs, then you try to run the remote query for Win32_Product, you will likely receive the “Generic Failure” error. This is more common in some environments than others, especially when the person that manages the workstations is the same person that deployed them or built the workstation “image,” since their profile would be more likely to contain “Per-User” installation entries.
What does this mean?
Basically, if any user account performs a “Per-User” installation, then that user will not be able to successfully perform a WMI query the Win32_Product class remotely from a different system. However, there is an exception to this. If the user that is running the remote WMI query is actually logged on to the remote system, then their profile will already be actively loaded and can be parsed without running into the failure.
The workaround to this problem for Windows XP and Windows Server 2003 systems is to run the query as a user account that has never installed software on the workstations. For instance, create a user account specifically used for software inventory or other management activities, then use that account to perform the queries. NEVER use that account to install software on the systems being monitored.
What about Operating Systems released after Windows XP and Server 2003?
Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2 do NOT display this same behavior. For these operating systems, rather than returning the “Generic Failure” message if a user is not logged on to the remote system, instead, only “Per-Machine” installation information would be returned. If the user IS logged on to the remote system, then the combination of “Per-User” and “Per-Machine” installation information is returned.
Additional information to be aware of:
Windows Server 2003 doesn’t have the Win32_Product Class by default
The Win32_Product class must be added to Windows Server 2003. If you receive the following error when running a WMI query for the Win32_Product class on Windows Server 2003
then chances are you need to add the class by doing the following:
1. Open “Add or Remove Programs”
2. Click “Add/Remove Windows Components”
3. Select Management and Monitoring Tools
4. Click Details.
5. Add a check to the box for “WMI Windows Installer Provider”
6. Click OK
7. Click Next
When the Windows Component Wizard finishes, you should now be able to access the Win32_Product class on Windows Server 2003.
What if I installed Windows Installer 4.5 and now I can’t use the Win32_Product class at all?
Then you probably need the following hotfix to get the Win32_Product class working again:
KB 972189: Error message when you query the “Win32_Product” class after you install applications by using Microsoft Windows Installer (MSI) 4.5 together with the “Per-User” option in Windows Server 2003 and in Windows XP: “0x80041001 – Generic failure”
Well folks, that’s all for now.
-Steve Paruszkiewicz [MSFT]