Why full WMI reset is not recommended
Full WMI reset (to the state when the operating system was installed) is a serious measurement that should be well thought about, if needed at all. After the reset, you will need to reinstall any software that uses WMI repository. If, for example, your Server is System Center Configuration Manager Distribution Point or Pull Distribution Point, then you should not have any problem resetting (though you will need to reinstall SCCM Client). However, keep in mind that if there are other uses for the server, you might need to check it afterwards. If you’re in a case, when you need to reset WMI and it fixed your system to the state when you can boot – backup your content and better reinstall. It should not be an escape solution.
Checking WMI repository for corruption
There is a command to check If the WMI is corrupt. In Command Line with Administrative privileges run:
If the repository is working fine you should get a message: “WMI Repository is consistent”.
The WMI doesn’t have to be corrupt in order for your software not to work properly. There are many software implementations (like SCCM Client) that use many settings from WMI repository. In most cases you can see in the logs that something is wrong with it and it points to many WMI settings. In this case you can understand that there is no simple solution to fixing these settings and it can take time, to find which ones and it is much easier to reset the WMI (or reinstall).
Full WMI Repository Reset
To merge current WMI repository with factory defaults, use:
If this still doesn’t help, make full reset of the WMI respository:
You should get “WMI Repository has been reset” message. If it is anything else, try to rerun the command.
You can check “winmgmt switches” and more explanations from Microsoft.
If it still fails for your needs, you can use an older method. Create a file named “ResetWMI.cmd” with a content of:
REM Turn winmgmt service Startup type to Disabled sc config winmgmt start = disabled REM Stop winmgmt service net stop winmgmt /y REM Register / Reregister Service DLLs regsvr32 /s %systemroot%\system32\scecli.dll regsvr32 /s %systemroot%\system32\userenv.dll REM Enter WBEM folder cd /d %systemroot%\system32\wbem REM Remove “repository” folder rd /S /Q repository REM Register / Reregister Service DLLs for /f %%s in ('dir /b /s *.dll') do regsvr32 /s %%s for /f %%s in ('dir /b /s *.exe') do regsvr32 /s %%s for /f %%s in ('dir /b *.mof') do mofcomp %%s for /f %%s in ('dir /b *.mfl') do mofcomp %%s REM Register / Reregister wmiprvse Service wmiprvse /regserver REM Register / Reregister winmgmt Service winmgmt /regserver REM Enter WBEM folder in SysWOW64 cd /d %systemroot%\SysWOW64\wbem\ REM Remove “repository” folder rd /S /Q repository REM Register / Reregister Service DLLs for /f %%s in ('dir /b /s *.dll') do regsvr32 /s %%s for /f %%s in ('dir /b /s *.exe') do regsvr32 /s %%s for /f %%s in ('dir /b *.mof') do mofcomp %%s for /f %%s in ('dir /b *.mfl') do mofcomp %%s REM Turn winmgmt service Startup type to Automatic sc config winmgmt start = auto REM Stop winmgmt service net start winmgmt
Run the file with Administrative privileges.
After you run it, there might be “Manageability” errors on Servers (maybe even clients), so you need to run again:
*** There is also a tool to reset WMI at Technet Gallery with Batch file commands and Powershell script. Does something similar.