What if you suspect WMI is corrupted and running winmgmt salvagerepository or resetrepository is not sufficient on Windows 2012 and Windows 8


Run the following script in cmd.exe spawn using Run As Administrator privileges:

@echo off
sc config winmgmt start= disabled
net stop winmgmt /y
%systemdrive%
cd %windir%\system32\wbem
for /f %%s in ('dir /b *.dll') do regsvr32 /s %%s
wmiprvse /regserver
winmgmt /regserver
sc config winmgmt start= Auto
net start winmgmt
for /f %%s in ('dir /s /b *.mof *.mfl') do mofcomp %%s

 

NOTE: for newer operating systems, you can replace winmgmt /regserver with  winmgmt /resetrepository.


Comments (4)

  1. Alberto says:

    Thanks a million, worked a treat, fixed all my services issues

  2. Frank says:

    This is totaly against this recommendations:
    http://blogs.technet.com/b/askperf/archive/2014/08/08/wmi-repository-corruption-or-not.aspx, where they say: Note: Under almost no circumstance should you use the script that rebuilds the WMI repository from the MOF files

  3. Cumhur says:

    There isn’t /regserver parameter for winmgmt on windows 2012 server. How to replace it?

    1. Bulent Ozkir says:

      Article corrected.