You can rebuild the WMI repository (the database that stores meta-information and definitions for WMI classes) if it becomes corrupted.
Procedure
-
Reboot the server.
-
Check the WMI repository for consistencies as follows:
-
For Windows 7, Windows Server 2008 R2, and newer operating systems, run the following command from a command prompt:
winmgmt/verifyrepository
-
For Windows XP and Windows Server 2003, run the following command from a command prompt:
WmiDiag checkconsistency
-
-
If the WMI repository is found to be consistent, do the following:
-
Run the following PowerShell commands to verify it:
-
PS C:> $query = “Select * from Win32_Bios”
-
PS C:> Get-WmiObject -Query $query
If the above commands do not produce any output or outputs any exceptions, the WMI repository is inconsistent. Proceed with Step 4, below, to fix it.
-
-
From a Windows computer, in the search or Run box, enter WBEMTEST and then press <ENTER>.
The Windows Management Instrumentation Tester dialog box appears.
-
Ensure that the computer is connected to the root/cimvw namespace, and then click Query.
The Query dialog box appears.
-
Enter SELECT * from Win32_Process in the Enter Query field, and then click Apply.
The Query Result dialog box appears.
If the query results produces any errors, the WMI repository is inconsistent. Proceed with Step 4, below, to fix it.
-
-
If the WMI repository is found to be inconsistent for Windows 7, Windows Server 2008 R2, and newer operating systems, do the following:
-
From a command prompt with elevated privileges, run the following command:
winmgmt/salvagerepository
Note
This command takes the content of the inconsistent WMI repository and merges it into the rebuilt repository if it is readable.
-
If this doesn't work, run the following command from a command prompt:
winmgmt/resetrepository
Note
This command resets the WMI repository to its initial state when the operating system was first installed.
-
If this doesn't work, rebuild the WMI repository manually as described in Step 5, below.
-
-
If the WMI repository is found to be inconsistent for Windows XP and Windows Server 2003, you must rebuild the WMI repository manually as described in Step 5, below.
-
Rebuild the WMI repository manually as follows:
Caution
Rebuilding the WMI repository may result in some third-party products not working until their setup is re-run & their Microsoft Operations Framework re-added back to the repository.
-
Change startup type to Window Management Instrumentation (WMI) Service to disabled.
-
Stop the WMI Service.
Note
You may need to first stop IP Helper Service or other dependent services before the system allows you to stop the WMI Service.
-
Rename the repository folder from C:\WINDOWS\system32\wbem\Repository to C:\WINDOWS\system32\wbem\Repository.old
-
From a command prompt with elevated privileges, enter the following:
cd c:\windows\system32\wbem
-
For
/f %s
in ('dir /b /s *.dll'
) doregsvr32 /s %s
-
Set the WMI Service type to Automatic and then start the WMI Service.
-
From a command prompt with elevated privileges, enter the following:
cd /d c:\
Important
You must go to the root of the c: drive.
-
For
/f %s
in ('dir /s /b *.mof *.mfl'
) domofcomp %s
-
Reboot the server.
-
Install the latest hotfixes for WMI, as they can help prevent further issues from occurring.
-
-
If the WMI repository is found to be consistent, see Troubleshooting if WMI Repository is Found to be Consistent.
What to Do Next
If you continue to have recurring WMI repository corruption issues on the same server, contact a Microsoft Support Engineer for further troubleshooting and assistance.