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