Repairing WMI Repository

Posted on Updated on

When troubleshooting WMI on SMS/SCCM clients, I’ve frequently used the following command to attempt a repair of the WMI repository.  I don’t recall where I found it (several years ago), but I also don’t want to ever forget it!

  1. Open a command prompt
  2. Change to directory C:\Windows\system32\wbem\
  3. Run: for /f %s in (‘dir /b *.mof *.mfl’) do mofcomp %s


5 thoughts on “Repairing WMI Repository

    Steve said:
    June 3, 2013 at 9:16 pm

    Thanks very much for taking the time to post this, resolved my issue. “MSI: Setup was unable to create the WMI namespace CCM.The error code is 80040154”

      N. Moseley responded:
      June 4, 2013 at 9:01 am


        Palpandi.v said:
        July 7, 2016 at 7:29 am

        what is ‘dir. I am getting the below error. Please advise me

        C:\Windows\System32\wbem>for /f %s in (`dir /b *.mof *.mfl’) do mofcomp %s
        The system cannot find the file `dir.

        N. Moseley responded:
        July 10, 2016 at 3:47 pm

        It’s a bad textual copy is all. In your comment I already spot that the leading quote mark (‘) is using what’s called a “smart quote” where it’s slanted. I’ll fix on my post, but just type in the command directly, it’ll work.

    jan said:
    October 24, 2018 at 12:09 pm

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

    ‘ instead of ´

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s