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
- Anonymous
November 24, 2014
Thanks a million, worked a treat, fixed all my services issues - Anonymous
May 06, 2015
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 - Anonymous
December 20, 2015
There isn't /regserver parameter for winmgmt on windows 2012 server. How to replace it?- Anonymous
April 08, 2016
Article corrected.
- Anonymous
- Anonymous
December 21, 2017
WMI: Stop hurting yourself by using “for /f %%s in (‘dir /s /b *.mof *.mfl’) do mofcomp %%s”https://blogs.technet.microsoft.com/yongrhee/2016/06/23/wmi-stop-hurting-yourself-by-using-for-f-s-in-dir-s-b-mof-mfl-do-mofcomp-s/