Get-WmiObject : Invalid class error

I’m trying to repair the SBSMonitoring database on a WIndows 2011 SBS box per this article here (, but I keep getting this error (see below). Does anyone know how to resolve?

Get-WmiObject : Invalid class
At C:\WINDOWS\TEMP\Create-SBSMonitoringDb.ps1:33 char:10

  • if ((gwmi <<<< win32_operatingsystem).version -like "6.0*") {
    • CategoryInfo : InvalidOperation: (:slight_smile: [Get-WmiObject], Managemen
    • FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.C

Can you just run this on the computer?

get-wmiobject -class win32_operatingsystem

By itself, in a powershell console window?

Nope, sure can’t.

PS C:\Users\bbusch> get-wmiobject -class win32_operatingsystem
Get-WmiObject : Invalid class
At line:1 char:14

  • get-wmiobject <<<< -class win32_operatingsystem
    • CategoryInfo : InvalidOperation: (:slight_smile: [Get-WmiObject], ManagementException
    • FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

Busch looks like you have a system issue with your WMI Class. Here is a good article on technet about troubleshooting WMI Providers and Classes that should help you out.

WMI is verified as consistent; any other suggestions?

PS C:\windows\temp> winmgmt /verifyrepository
WMI repository is consistent
PS C:\windows\temp>

If you’ve verified that you ran the command as a local Administrator, and it isn’t retrieving Win32_OperatingSystem when you’re in a local console window (which says “Administrator” in the title bar), then I’m gonna go with “borked system.” I’m a little hesitant to recommend a fix because I’m not at all familiar with SBS or any weirdness it may have.

does this work?
Get-WmiObject -Class “win32_operatingsystem” -Namespace “root/cimv2”

Can we handle this exception !!