Get-WmiObject : Invalid class error

I’m trying to repair the SBSMonitoring database on a WIndows 2011 SBS box per this article here (http://blogs.technet.com/b/sbs/archive/2011/08/22/how-to-recreate-the-sbsmonitoring-database.aspx), 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
      tException
    • FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.C
      ommands.GetWmiObjectCommand

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.

http://blogs.technet.com/b/askperf/archive/2014/08/11/wmi-missing-or-failing-wmi-providers-or-invalid-wmi-class.aspx

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 !!