Event ID 4 — WMI Repository Availability and Integrity

Applies To: Windows Server 2008 R2

The WMI repository is the Windows implementation of the CIM Repository as defined by the Deskop Management Task Force (DMTF). It is a database managed by the WMI Service that stores WMI class and instance information. Static classes with static instances store class definitions and instances in the WMI repository. Static classes with dynamic instances store only the definitions. Dynamic classes store neither the class definitions nor the instances. Dynamic information is supplied on-demand by a WMI provider.

Event Details

Product: Windows Operating System
ID: 4
Source: Microsoft-Windows-WMI
Version: 6.1
Message: Error %1 encountered when trying to load MOF %2 while recovering .MOF file marked with autorecover


Perform a manual compilation of MOF files.

The content of the WMI repository is stored in a binary format, but developers describe the content by using text files called "MOF files." MOF files are compiled and stored in the repository by using a command-line tool called mofcomp.

Try to manually compile each MOF file that is reported in the failure report during the autorecovery process. To manually compile a MOF file, open a command prompt and navigate to the directory where MOF files are stored by typing cd %SYSTEMROOT%\SYSTEM32\WBEM. Next, type mofcomp <mof_filename>.

You must validate the MOF file listed and ensure it exists in the specified location. Ensure that the file system rights grant access to the MOF file for the SYSTEM account.

If a MOF file fails to recover, it could be because the file system is corrupt. In such a case, type chkdsk /f from a command prompt window to validate the consistency of the file system.

Note: If the problem MOF file is CIMWIN32.MOF, most WMI functionality will be impaired. This MOF file is critical for WMI to run properly because it contains all root/cimv2 WMI classes and most of the supported OS providers. If you determine that your file system is corrupted, you can try using a copy of the MOF file from a working system using the same OS version and service pack.


To verify that the WMI repository is in a consistent state, at a command prompt window type winmgmt /verifyrepository. If the repository is consistent, the following message will be displayed: "WMI repository is consistent". Also, the ERRORLEVEL environment variable will be set to zero (0), which you can check by typing echo %errorlevel%.

WMI Repository Availability and Integrity

Management Infrastructure