
For much longer than I care to admit I was struggling to monitor any Windows services using WMI on one of my Windows 2008 Servers. Instead I received the dreaded "Invalid Class" error in the APM info window. This was later confirmed using WBEMTEST. When using WMI Explorer it was clear to see that the "Win32_PerfRawData_PerfProc_Process" class did not exist.
I opened a case with Solarwinds support and was directed to their WMI support document and related online documentation. Unfortunately none of the information provided proved useful in this circumstance.
I spent a several hours googling around and was able to find several others with my issue, but no one had found a solution. With nowhere else to go, I spent the $250.00 and called Microsoft Support. It took a few days, and at least three Microsoft support engineers later that we finally got to the root of the problem. I knew from the very beginning that this was going to be something stupid, but I never realized just how obscure the problem would be, so I decided to save others my pain and post my resolution in hopes that others might find it useful in the future.
We went into registry “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\PerfProc\Performance” In the right hand pane we found that “Disable Performance Counters” was set to 1, which means it was disabled. We used “exctrlst.exe” tool, enabled ‘perfproc’ and rebooted. After Rebooting we were able to run the WMI query (SELECT * from Win32_PerfRawData_PerfProc_Process where NAME <> '_Total') using the WBEMTEST tool built into Windows. After verifying with WBEMTEST I confirmed that APM was properly polling my monitored services properly.
I hope someone else finds this helpful.
Thanks Alterego for posting this--it will help the community.
M
This fixed the problem I was having, thanx!!
fixed our problem as well...
however we didnt use the microsoft tool (difficult procedure to install new software on servers...), for us it was enough to set the registry entry to 0 (and reboot the server of course)
thanks for sharing this with us
You can install the tool on your workstation and the tool can connect to the server.
aLTeReGo you're a saviour. I also spent hours (days) on this. Your solution worked perfectly.
I've had the problem a few time and found a shot gun approach works sometimes, here is my notes
Shotgun:
cd /d %Systemroot%\system32\wbem
winmgmt /regserver
for %i in (*.dll) do RegSvr32 -s %i
for %i in (*.exe) do %i /RegServer
wmiadap /f
winmgmt.exe /resyncperf
winmgmt.exe /verifyrepository
for %i in (*.mof, *.mfl) do Mofcomp %i
Check Permission and if dcom enabled:
dcomcnfg - Properties - Default Properties - enable
Try to use windows repair:
rundll32 wbemupgd, RepairWMISetup
Stuff I had to do for exchange when it stoped working:
cd /d "D:\Program Files\exchsrvr\bin"
regsvr32 /s cdowf.dll
regsvr32 /s exwmi.dll
A little more destructive shot gun:
winmgmt /clearadap
winmgmt /****
winmgmt /unregserver
winmgmt /regserver
winmgmt /resyncperf
wmiadap.exe /f
wmiadap.exe /f
wmiadap.exe /f
wmiadap.exe /f
MS debugging tool:
cscript c:\Temp\wmidiag\WMIDiag.vbs WriteInRepository=Root
aLTeReGo you're a saviour. I also spent hours (days) on this. Your solution worked perfectly.
Glad I could help! I'm just sorry you didn't stumble upon this post sooner so you didn't have to spend hours/days troubleshooting like I did.
Thanks!!! ...been looking into this for days and fixed my issue
We have had this problem for a while with W2K8 (not R2) and have a alert monitor that triggers if a perfmon based counter is in unknown status and the node is 'up' status without have rebooted in the last 15 minutes. We pass the ${Node.SysName} is a variable to the script. This resolves it w/out the reboot and no manual intervention.
' Usage: cscript.exe apm_unknown.vbs %hostname%
'==========================================================================
strComputer = wscript.arguments.item(0)
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'''WMI RESYNC PERF'''
strExe = "winmgmt /resyncperf"
Wscript.StdOut.Write strComputer
set objWMIService = getobject("winmgmts://"_
& strComputer & "/root/cimv2")
Set objProcess = objWMIService.Get("Win32_Process")
Set objProgram = objProcess.Methods_( _
"Create").InParameters.SpawnInstance_
objProgram.CommandLine = strExe
Set strShell = objWMIService.ExecMethod( _
"Win32_Process", "Create", objProgram)
'''WMI SALVAGE REPOSITORY'''
strExe = "winmgmt /salvagerepository"
Wscript.StdOut.Write strComputer
set objWMIService = getobject("winmgmts://"_
& strComputer & "/root/cimv2")
Set objProcess = objWMIService.Get("Win32_Process")
Set objProgram = objProcess.Methods_( _
"Create").InParameters.SpawnInstance_
objProgram.CommandLine = strExe
Set strShell = objWMIService.ExecMethod( _
"Win32_Process", "Create", objProgram)
'''Reload Windows Counters'''
strExe = "C:\WINDOWS\SYSTEM32\lodctr /R"
Wscript.StdOut.Write strComputer
set objWMIService = getobject("winmgmts://"_
& strComputer & "/root/cimv2")
Set objProcess = objWMIService.Get("Win32_Process")
Set objProgram = objProcess.Methods_( _
"Create").InParameters.SpawnInstance_
objProgram.CommandLine = strExe
Set strShell = objWMIService.ExecMethod( _
"Win32_Process", "Create", objProgram)
Wscript.Sleep 5000
'''ENABLE PERFPROC Performance Counter'''
Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CURRENTCONTROLSET\SERVICES\PERFPROC\Performance"
strValueName = "Disable Performance Counters"
strValue = "0"
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strValueName = "Disable Performance Counters"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
'''REMOTE REGISTRY AND DEPENDENTS'''
Set colServiceList = objWMIService.ExecQuery("Associators of " _
& "{Win32_Service.Name='REMOTEREGISTRY'} Where " _
& "AssocClass=Win32_DependentService " & "Role=Antecedent" )
For Each objService in colServiceList
objService.StopService()
Next
Wscript.Sleep 5000
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='REMOTEREGISTRY'")
For Each objService in colServiceList
errReturn = objService.StopService()
Next
WScript.Sleep 10000
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='REMOTEREGISTRY'")
For Each objService in colServiceList
errReturn = objService.StartService()
Next
Wscript.Sleep 5000
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='DFS'")
For Each objService in colServiceList
errReturn = objService.StartService()
Next
'''WMI AND DEPENDENTS'''
Set colServiceList = objWMIService.ExecQuery("Associators of " _
& "{Win32_Service.Name='Winmgmt'} Where " _
& "AssocClass=Win32_DependentService " & "Role=Antecedent" )
For Each objService in colServiceList
objService.StopService()
Next
Wscript.Sleep 5000
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='Winmgmt'")
For Each objService in colServiceList
errReturn = objService.StopService()
Next
WScript.Sleep 10000
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='Winmgmt'")
For Each objService in colServiceList
errReturn = objService.StartService()
Next
Wscript.Sleep 5000
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='iphlpsvc'")
For Each objService in colServiceList
errReturn = objService.StartService()
Next
WScript.Quit
Thank you!!!
Heaps of articles did not mention this reg key.
The question is though, WHY WAS IT SET?
Anybody know?
I'm now battling this same issue on one of our Server 2008 boxes. We migrated from a 2k3 server to 2k8 and thats when the WMI monitors stopped working. I've gone through the SolarWinds document and checked all the permissions and reset WMI with the winmgt commands.
I looked in the registry for the key mentioned above, but it is not there. Any ideas where it would be?
Late to the party, I ran into this issue, and your post corrected my client access server's inability to report back to APM. Thanks a million aLTeReGo.