Troubleshoot WMI errors

Article author
Chris Todd
  • Updated

In some instances when installing the Windows Roaming Client, it may produce an error caused by a malfunction in Windows Management Instrumentation (WMI). For example, an operation fails with message "WMI 'ExecQuery' failed".

WMI is Windows Management Instrumentation on Windows OS machines used to get information about disks, system and services.

This article describes how to resolve WMI errors.

Confirm WMI has failed

  1. Launch the WMI MMC snap-in
    1. Go to Start > Run (or Win + R)
    2. Enter (run) wmimgmt.msc
  2. Right click WMI Control (Local) and select Properties
    WMI01.png

If WMI is working correctly, there will be a "Successfully Connected to <local computer>" message in the Properties window.

  • Retry to install the Windows Roaming Client or other task that caused WMI to fail.

WMI02.png

If WMI is NOT working correctly, you see Invalid class or another error message. Attempt these steps to resolve.

  1. Check for a corrupt WMI repository.
  2. Complete additional troubleshooting by checking the Event Viewer.

Check for WMI repository corruption

  1. Open a command prompt, running as an administrator
    1. Select Win key
    2. Type cmd
    3. Right-click on Command Prompt
    4. Select Run as administrator
  2. Enter winmgmt /verifyrepository
  3. Check the returned message
    • If the repository is NOT corrupted, "WMI Repository is consistent" will be returned.
      Exit the command prompt and move on to further troubleshooting steps.
    • If the repository IS corrupted, perform a recovery of the repository to correct.

WMI Repository Recovery

In some cases, the actual commands may vary based on which version of Windows OS is running. If in doubt, check with Microsoft Support.

Running as an administrator, run the following.

  1. Disable and stop the WMI service
    • sc config winmgmt start= disabled
    • net stop winmgmt
  2. Run the salvage repository commands
    • Winmgmt /salvagerepository %windir%\System32\wbem
    • Winmgmt /resetrepository %windir%\System32\wbem
  3. Enable the WMI service
    • sc config winmgmt start= auto

Reboot and check for WMI repository corruption, again.

  • If the repository is no longer corrupt, rerun the Roaming Client install or other task that caused WMI to fail (and if it is still failing, move onto the additional troubleshooting below)
  • If the repository IS still corrupted, try recreating the repository

WMI Repository Recreation

In some cases, the actual commands may vary based on which version of Windows OS is running. If in doubt, check with Microsoft Support.

Running as an administrator, run the following.

  1. Disable and stop the WMI service
    • sc config winmgmt start= disabled
    • net stop winmgmt
  2. Rename the repository (archive it)
    • Rename the repository folder found at %windir%\System32\wbem\ to repository.old
  3. Enable the WMI service
    • sc config winmgmt start= auto
  4. Recreate the repository
    • The repository will recreate itself by running any app that uses WMI
    • Run the WMI MMC snap-in we ran earlier will work
      1. Go to Start > Run (or Win + R)
      2. Enter (run) wmimgmt.msc
      3. Right click WMI Control (Local) and select Properties
    • There will be a short delay while the repository is recreated
      Reboot and check for WMI repository corruption, yet again.
  • If the repository is no longer corrupt, rerun the Roaming Client install or other task that caused WMI to fail (and if it is still failing, move onto the additional troubleshooting below).
  • If the repository IS still corrupted, contact Microsoft Support for additional assistance to resolve before troubleshooting additional causes.

Troubleshoot Further

Enabling WMI event tracing

In order to troubleshoot, WMI event tracing needs to be enabled

  1. Open the Event Viewer
    1. Go to Start > Run (or Win + R)
    2. Enter (run) eventvwr.msc
  2. When the Event Viewer opens, open the View menu
  3. If not checked, select Show Analytic and Debug Logs
  4. Scroll down to find WMI Activity at Applications and Service Logs > Microsoft > Windows > WMI Activity
  5. Right-click on Trace
    If Trace isn't listed, validate that Show Analytic and Debug Logs is checked
  6. Select Properties from the menu
  7. In the Properties window, tick the Enable Logging check box
    WMI04.png
  8. Select OK or Apply

Investigate and Resolve

  1. Rerun the Roaming Client install or other task that caused WMI to fail
  2. Check the WMI-Activity event window (select Trace)
  3. Double-click an event to view the detailed information
    1. In some cases, information will be provided with the error on how to resolve
    2. Otherwise, use the Event ID and Source, and search online for potential solutions
    3. Else, contact Microsoft Support

 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.