Repairing and rebuild WMI repository
How to repair or rebuild the WMI repository in Windows via CMD
Repairing the repository
Run the following commands in CMD
- Disable the WMI service
sc config winmgmt start= disabled
- Stop the WMI service
net stop winmgmt
- Salvage and reset the repository
winmgmt /salvagerepository C:\WINDOWS\System32\wbem
winmgmt /resetrepository C:\WINDOWS\System32\wbem
- Re-enable the WMI service
sc config winmgmt start= auto
- Restart Windows
shutdown /f /r /t 0
Rebuilding the repository
Run the following commands in CMD
- Disable the WMI service
sc config winmgmt start= disabled
- Stop the WMI service
net stop winmgmt
- Rename the existing repository
rename "%WINDIR%\system32\wbem\repository" "repository.bkup"
- Re-enable the WMI service
sc config winmgmt start= auto
- Restart Windows
shutdown /f /r /t 0
- Delete repository backup if no issues (optional)
rmdir /S /Q "%WINDIR%\system32\wbem\repository.bkup"