Rebuild a Corrupt WMI Repository

Be the first to vote!

From time to time, many administrators have found themselves faced with a corrupt WMI repository. Here’s a quick fix. Copy/paste into a .bat file and run on the affected computer.

NET STOP WINMGMT /y

RD /S /Q C:\Windows\system32\wbem\Repository

%windir%\system32\rundll32 wbemupgd,UpgradeRepository

FOR %%i in (%windir%\system32\wbem\*.dll) do RegSvr32 -s %%i

FOR %%i in (%windir%\system32\wbem\*.exe) do %%i /RegServer

You’ll probably get a pop-up for wbemtest when you run this script because of the FOR loop including all *.exe files. Simply click “exit” when the wbemtest application launches.