Monday, August 4, 2008

How to check the WMI repository before rebuilding it

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:
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
rundll32 wbemupgd, RepairWMISetup

Happy WMI Check,

No comments: