Jeff Gilbert's Web blog at myITforum.com

This posting is provided "AS IS" with no warranties, and confers no rights :-)
How to check the WMI repository before rebuilding it

I've had some WMI repository repair tidbits stashed away in my e-mail that I was going to blog about sooner or later. I'm not sure if today is sooner or later, but I did have to go looking through my old e-mails to find these steps for a lab machine today, and figured that was a sign I should finally post this information to the blog. If you suspect that the WMI repository has been corrupted, before throwing in the towel and blowing it away you can/should try to repair it 

I couldn't remember where I got these command lines so I had to go look them up again! Looks like if the repository can't be repaired, it will be recreated anyway: http://www.microsoft.com/technet/scriptcenter/topics/help/wmi.mspx

Of course, you could use the WMI Diagnosis Utility to check for WMI corruption, but I'm a pretty impatient person at heart and find that this is just faster for me. The steps when using these commands go kind of like this--check it, fix it and worst case replace it.

Anyway, to check the WMI repository for errors on a Server 2003 SP1 or SP2 systems, run the following command from command prompt:

rundll32 wbemupgd, CheckWMISetup 

Once you've run that command, check the setup.log file located at: %windir%\System32\Wbem\Logs\Setup.log.  Check for entries from today's date.  If you find none, then WMI is probably OK and you should continue troubleshooting somewhere else.  If however, you see an error message from today saying that it can't find a namespace then yes, your WMI repository does have issues and you should do the below:

rundll32 wbemupgd, RepairWMISetup

This will re-create your WMI repository minus any custom .mof additions that were implemented without the -autorecover switch.

For Windows XP SP2, use the following command to check for corruption, and repair if necessary:

rundll32 wbemgupgd, UpgradeRepository

For Windows XP SP1, the check and repair commands are below and function just like the Windows Server 2003, SP1 commands:

rundll32 wbemupgd, CheckWMISetup

and

rundll32 wbemupgd, RepairWMISetup

 

*******************************************************************************************************************************************************************************************

UPDATE: For Windows Vista and Windows 7:
(I found this info on the WMI team blog originally)

Note: You must perform this procedure from an elevated command prompt (right-click command prompt on the start menu and select 'run as administrator'. 

Type the following command:

winmgmt  /salvagerepository

The above command performs a consistency check on the WMI repository, and if an inconsistency is detected, rebuilds the repository. The content of the inconsistent repository is merged into the rebuilt repository, if it can be read.

*******************************************************************************************************************************************************************************************

Hope this helps,

~Jeff

Published Friday, January 11, 2008 1:30 AM by jgilbert

Filed under:

Comments

# Client health solutions@ Sunday, March 23, 2008 3:02 PM

Summary: we talk about client health a lot on this blog, but ultimately we all want solutions. What solutions

Paul Thomsen at myITforum.com

# how to fix a corrupted wmi file@ Friday, May 30, 2008 8:46 PM

Pingback from  how to fix a corrupted wmi file

how to fix a corrupted wmi file