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: – “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 : 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.


One thought on “Rebuilding the WMI (Windows Management Instrumentation) Repository

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s