Monday, August 7, 2017

WMI is broken. "Configuration refresh failed with the following error: Invalid class"

Scenario:

When we start Server Manager on Windows Server 2012 R2 the flag lights up "Red" almost immediately with the error:
"Configuration refresh failed with the following error: Invalid class"


Get-WindowsFeature ends with the same "Invalid class" error.

Solution:

Backup WMI:

  • Launch the WMI MMC snapin by Start -> Run -> then enter WMIMGMT.MSC
  • Right click WMI Control (Local) and click Properties
  • Tab Backup/Restore, press Back Up Now...

Recompile .mof & .mlf files by running the following commands from an Elevated Command Prompt (Admin):
CD C:\Windows\System32\WBEM
dir /b *.mof *.mfl | findstr /v /i uninstall > moflist.txt & for /F %s in (moflist.txt) do mofcomp %s
Refresh "Server Manager" or re-open it.

References: