10 Jan 2013

Rebuilding the WMI (Windows Management Instrumentation) Repository

Hello everyone,
Today I had a problem on a server running Windows Server 2008, the WMI repository on the server got inconsistent and I had to rebuild it
As it is written on wikipedia:
http://en.wikipedia.org/wiki/Windows_Management_Instrumentation"Windows Management Instrumentation (WMI) is a set of extensions to the Windows Driver Model that provides an operating system interface through which instrumented components provide information and notification".
The location of the WMI Repository is "%windir%System32\Wbem\Repository" , you can check here the size and when the WMI Respository was created/modified:
Windows Repository

Take good precaution when you are manipulating the WMI Repository because it can harm your system or the applications that are installed. Before you start working with it do a little diagnosis by running the application
WMI Diagnosis Utility, you can download it from Microsoft's website : http://www.microsoft.com/en-us/download/confirmation.aspx?id=7684. Check also event viewer for some WMI errors. After you know that there is a problem with the wmi repository try the following:
Open cmd with administrator credentials
Add the following in a .bat file (only the Bold lines):
@echo off
sc config winmgmt start= disabled
This command will set the Winmgmt service to be disabled upon startup. Read more about Winmgmt here:
net stop winmgmt /y
Stops the winmgmt service
cd %windir%
Changes directory to windows location
cd system32\wbem
Changes directory to wbem folder
for /f %%s in ('dir /b *.dll') do regsvr32 /s %
for all .dll files to a register
wmiprvse /regserver 
registers the wmiprvse service
winmgmt /regserver 
registers the winmgmt service
sc config winmgmt start= auto
This command will set the Winmgmt service to auto start upgon startup
net start winmgmt
Starts the winmgmt service
for /f %s in ('dir /s /b *.mof *.mfl') do mofcomp %s
for all .mof and .mfl files recompile them using mofcomp command

shutdown /l /r

If this solution doesn't resolve the issue then try the following:
Winmgmt /verifyrepository 
This command will check the repository status. If the status is inconsistent then type the following
Winmgmt /salvagerepository
This command will try to salvage the repository by merging the content of the repository into a rebuild repository if it's possible
Winmgmt /verifyrepository
If the status is consistent then your job is done if the status is still inconsistent

Winmgmt /resetrepository
This command will reset the repository and will reset it to defaults

This steps should fix the problem, I hope this post will help if you encounter the same problem.
For now have a nice day.

About me

After finishing a Computer Science University I've started working as an IT support technician for an Outsourcing company. Since then, I've changed my profile a couple of times and now I work as a System Administrator at one of the biggest companies in the gaming industry. I'm constantly learning new things in this domain so I thought of creating this website for sharing my experiences. Until now, I've taken the Cisco Certificate Network Associate exam and several Microsoft certifications. Now, I am in the process of learning Unix and enhance my programming skills.


  1. Everyone wants that dream where they finally get an information technology management position. For some people it’s a major definition in one’s career.
    Information Technology