Managed Object Format (MOF) file is the mechanism by which information about WMI classes is entered into the WMI Repository. It is possible that the class definitions currently in the Repository somehow do not show up the values. In this case, recompiling your .MOF files will cause those class definitions to be overwritten and replaced with the same, uncorrupted class definitions used when the operating system was originally installed.
To repair/re-sync the WMI repository, please follow the steps given below:
1. Open the Command Prompt with administrator privileges.
2. Verify whether the WMI repository is corrupted by running the below command :
winmgmt /verifyrepository
If the repository is not corrupted, a WMI Repository is consistent message will be returned. If the repository is consistent, the repository is not the problem. You will have to check your server for other issues. If you get any other message, go to step 3.
3. Execute the below command to repair the WMI repository:
winmgmt /salvagerepository
If the above command fails to work, on the remote windows server, stop the Windows Management Instrumentation service and execute the below command:
winmgmt /resetrepository
After the last command, you should see a WMI Repository has been reset message. This will verify whether the command was successful. After this, start the Windows Management Instrumentation service.
If not, you will see the following output:
If you're using any of the following Windows versions, choose execute the specified commands:
For Windows 2003:
2. lodctr /R
For Windows 2000/XP :
1. winmgmt /clearadap
2. winmgmt /kill
3. winmgmt /regserver
4. winmgmt /resyncperf
To reconstruct the WMI repository, please follow the steps given below:
1. On the remote windows server, disable and stop the Windows Management Instrumentation service.
2. Take a backup of C:\%windir%\System32\wbem\Repository directory.
3. Open the Command Prompt with administrator privileges and execute the below commands one by one to reconstruct all the WMI classes:
cd C:\%windir%\system32\wbem
for /f %s in ('dir /b /s *.dll') do regsvr32 /s %s
for /f %s in ('dir /b /s *.mof') do mofcomp %s
for /f %s in ('dir /b /s *.mfl') do mofcomp %s
Note: In the above commands, replace %windir% [Windows Directory name] with:
- windows in case of Windows 2003/XP/2008
- winnt in case of windows 2000
- Windows in case of other Windows versions
5. Enable and start the Windows Management Instrumentation service again.
For more details, refer the following links from Microsoft's official documentation: