Fixing WMI corruption

Microsoft has released a series of blogs regarding WMI troubleshooting:
Troubleshooting WMI Series coming
One should really read this updated (August 2014) article, as this information supersedes whats below.

Corruption of the Windows Management Instrumentation (WMI) repository can be the reason that group policies fail to apply.  You can tell if the WMI repository is corrupt by performing WMI queries to the machine, and have the commands return errors.  Another more common symptom is when one runs a “gpupdate /target:computer /force”, and gets back an error such as “The processing of Group Policy failed. Windows could not evaluate the Windows Management Instrumentation (WMI) filter for the Group Policy object cn=<group policy GUID>….”.

These procedures were tested on Windows 7 machines.  Windows XP and Windows 2003 may require different solutions. (http://windowsxp.mvps.org/repairwmi.htm)

The first way, which is probably the safer approach, is to first stop the “Windows Management Instrumentation” service (C:\>net stop “windows management instrumentation”).  It may need to stop other services dependent on it; be sure to do so.  Then, run a salvage on the repository (C:\>winmgmt /salvagerepository).  This can take up to 10 minutes or more.  Afterwards, rerun gpupdate, and reboot.  This will ensure that appropriate group policies get applied.

The second way is a bit more drastic.  As above, stop the WMI service, along with any dependent services.  Then, delete all the repository files out of the %SystemRoot%\System32\Wbem\Repository folder.  One can then run the salvage command above, or just reboot.  The repository will be rebuild on reboot.  However, a second reboot may be necessary to get all appropriate group policies applied, as the WMI repository might not get rebuilt in time to accurately process the group policies on bootup.

Please note that there may be installed software applications on the system that add information to the WMI repository.  Some applications might notice it’s missing WMI information in the repository and perform a “repair” operation, installing the application WMI information back into the repository.  Other applications may not.