Troubleshooting Invalid WMI class error

Error message "Invalid WMI class" on computers running on Windows 7 or Windows server 2008 R2

WMI is a component that is used for collecting metrics like CPU/memory/disk usage in the server. If the WMI component is corrupted, it will not be able to collect any data from the server.

Please perform the following steps to check if the WMI component is corrupted:
  1. Go to Run command and type wbemtest.exe
  2. Click Connect in the opened dialog box

  3. Once connected, click Query
  4. Type in "select * from Win32_process" under Enter Query and select Apply

  5. The error message "WBEM_E_NOT_FOUND" will appear if wmi is corrupted
To repair the WMI repository on Windows Vista or 2008:

Open an Administrator command prompt and run the following command:
winmgmt /salvagerepository

To repair the WMI repository on Windows 2003 or earlier:
  1. Close any existing WBEMTest processes on the server that is monitored
  2. Open an Administrator command prompt and run the following commands:
    cd /d %windir%\system32\wbem
    for %i in (*.dll) do RegSvr32 -s %i
    for %i in (*.exe) do %i /RegServer
    net stop winmgmt /y
  3. Wait for five seconds and then run the following commands:
    cd c:\windows\system32\wbem
    rd /S /Q repository
    Note:: If the repository directory is not deleted, try renaming it
  4. Copy and paste the following script in a text editor, and save the file as a .bat file.
    regsvr32 /s %systemroot%\system32\scecli.dll
    regsvr32 /s %systemroot%\system32\userenv.dll
    mofcomp cimwin32.mof
    mofcomp cimwin32.mfl
    mofcomp rsop.mof
    mofcomp rsop.mfl
    for /f %%s in ('dir /b /s *.dll') do regsvr32 /s %%s
    for /f %%s in ('dir /b *.mof') do mofcomp %%s
    for /f %%s in ('dir /b *.mfl') do mofcomp %%s
    mofcomp exwmi.mof
    mofcomp -n:root\cimv2\applications\exchange wbemcons.mof
    mofcomp -n:root\cimv2\applications\exchange smtpcons.mof
    mofcomp exmgmt.mof
  5. Run the .bat file from an Administrator command prompt.
  6. Run WBEMTest on the application server and run the failing query. For example:
    SELECT * from Win32_PerfRawData_PerfProc_Process where NAME <> '_Total'
  7. If the "Invalid Class" error persists, close any WBEMTest processes, open an Administrator command prompt, and then run these commands:
    cd c:\windows\system32\wbem
    ren repository repository_old
    winmgmt /resyncperf

    • Related Articles

    • Troubleshooting tips for Quota violation and WMI error while running WMI queries and scripts

      While running a script or WMI query, you may get the error message "Quota violation". This can be because the WMI provider service may have reached its quota limit. Troubleshoot by following the below steps: Go to Start > Run > type wbemtest.exe ...
    • Checking WMI reachability

      To check WMI reachability From your On-Premise Poller installed Windows machine, go to Start > Run > wbemtest.exe and run it as an administrator. In the Windows Management Instrumentation Tester screen, click Connect. Enter the following in the ...
    • How to collect Applications and Services Logs from Windows event logs

      Site24x7 AppLogs uses the Windows Management Instrumentation (WMI) query on the Site24x7 Server Monitoring agent to fetch event logs. The WMI module requires the registry entry below to read the event logs from the Applications and Services Log ...
    • How to troubleshoot my Windows PowerShell Plugin?

      By default, the Site24x7 monitoring Windows agent will run as a SYSTEM user. In case, if you would like to verify if the plugin script is giving the output properly as SYSTEM user, follow these steps: Download PsExec from this link and extract the ...
    • How to uninstall the Site24x7 Windows Server Monitoring Agent

      Method 1: To uninstall the Site24x7 Windows Server Monitoring Agent, click the link below: Unzip and execute the Uninstall.bat file in the Command Prompt as an ...