WMI: Recompiling WMI MOFs
Published Mar 15 2019 08:38 PM 11.2K Views
First published on TECHNET on Apr 13, 2009


Description: Managed Object Format (MOF) is a compiled language, created by the Distributed Management Task Force (DMTF) and based on the Interface Definition Language (IDL).  The MOF file is a mechanism for expressing and registering the classes, providers, properties, and instances for a particular WMI repository implementation.  Providers can use the MOF Compiler (MOFComp.exe) to add the classes to the WMI Repository.

Scoping the Issue: If you have previously rebuilt the WMI Repository and are running into issues, it is possible that you are missing application specific data (MOF files) in the repository.  This is where the MOFComp.exe compiler comes into play.

Data Gathering: In all instances, collecting either MPS Reports with the General, Internet and Networking, Business Networks and Server Components diagnostics, or a Performance-oriented MSDT manifest must be done.  Additional data required may include the following:

  • For Windows 2000, Windows XP, and Windows Server 2003, download and run the WMI Diagnosis Utility

  • For Windows Vista, Server 2008, and Windows 7, run the "winmgmt /verifyrepository" command to check for an inconsistent repository

As an alternative to rebuilding the repository, you can try manually recompiling all of the default WMI .mof files and .mfl files by using the command shown below (Note that this process can take awhile to complete). After the process completes, the Mofcomp.log file (%systemroot%\Windows\system32\wbem\Logs) should be examined to ensure that there were no compilation failures. In most cases the following command will need to be executed twice in order to account for some of the inherent dependencies between objects defined in the various .mof files:

for /f %s in ('dir /b *.mof *.mfl') do mofcomp %s

Note the above command should be run from the "%systemroot%\system32\wbem" folder

Troubleshooting / Resolution: Once you have gathered the data, review the Event Logs for WMI errors.  If you have captured the output from the WMI Diagnosis Utility , review the logs and resolve any errors where possible.  Since WMI is such an integral part of Windows Operating System, please engage a Microsoft Support Engineer for assistance.

Additional Resources:

Version history
Last update:
‎Mar 15 2019 08:38 PM
Updated by: