A new script error – SCOMpercentageCPUTimeCounter.vbs – Invalid class


As you deploy the latest OpsMgr R2 core MP updates version 6.1.7599.0 which I blogged about HERE, you will probably notice a new script error popping up in your environment:

Alert Description:

The process started at 10:36:57 AM failed to create System.PropertyBagData. Errors found in output:

C:\Program Files\System Center Operations Manager 2007\Health Service State\Monitoring Host Temporary Files 2\4885\SCOMpercentageCPUTimeCounter.vbs(125, 5) SWbemRefresher: Invalid class

Command executed: "C:\Windows\system32\cscript.exe" /nologo "SCOMpercentageCPUTimeCounter.vbs" servername.domain.com false 3
Working Directory: C:\Program Files\System Center Operations Manager 2007\Health Service State\Monitoring Host Temporary Files 2\4885\

One or more workflows were affected by this.
Workflow name: Microsoft.SystemCenter.HealthService.SCOMpercentageCPUTimeMonitor
Instance name: servername.domain.com
Instance ID: {50E57AC1-08CC-6E7E-149A-1E8690881BBD}
Management group: MGNAME

This is caused by a new script based monitor (Agent Processor Utilization) and collection rule (Collect agent processor utilization) that was added to this core MP… which measures the agent CPU impact, including the Healthservice, MonitoringHost, and all ancillary processes spawned by the SCOM agent.  This monitor and rule targets the Health Service class:

image

image

Both the monitor and rule share the same script datasource – so make sure if you override ANYTHING on one, you make the SAME override on the other…. otherwise you will break cookdown for the datasource.

 

The problem is – there is a fair percentage of Windows Servers – that for some reason randomly will have a problem with WMI health, or (more likely) will not have the WMI performance counters enabled for Perfproc.dll, which this script needs in order to measure the CPU.

This is not a big deal… but until you fix this – the monitor wont work…. and will throw these script errors on a regular basis.

The good thing is – this issue is fully documented in the guide that ships with these new MP’s.  You DID read the guide first – didn't you?  🙂  The guide lists many possible steps to go through in order… I will discuss the most common resolution I am seeing in the field, below.

 

So – gather a list of all servers throwing this specific script error for “Invalid class” on “SCOMpercentageCPUTimeCounter.vbs”, then make plans to fix them.  This will likely require a reboot – so keep that in mind.  Another alternative is to fix them now, and then let them get rebooted on their next patching cycle if that works better for you.

 

What is typically seen – is that there is a missing WMI class, due to the WMI perf counter being disabled.  Right now this appears pretty random…. I have three VM’s all built from the same media on the same day – and one out of those three had this issue.  I recently worked with a customer who had 4 machines out of 16 missing this perf counter.  Here is an example of the WMI class we are looking for:  (Run wbemtest, connect to root\cimv2, then click Enum Classes, select recursive, OK)

clip_image002

 

 

Luckily – the fix is VERY simple.  There is a tool you can download and install on your workstation – and remotely connect to each machine and fix them:

Windows 2000 Resource Kit Tool : Extensible Performance Counter List (exctrlst.exe)

http://download.microsoft.com/download/win2000platform/exctrlst/1.00.0.1/nt5/en-us/exctrlst_setup.exe

 

Using this tool – connect to \\servername and click refresh.  Sroll down in the list until you find “PerfProc     perfproc.dll”.  What you will likely find is that this class is disabled. 

image

 

Simply check the box to enable it…   and then reboot the machine at your convenience. 

This will persist the class in WMI and the script error should go away.

 

 

Other errors from this script:

Now – if you are getting some OTHER error – not “Invalid Class”… this is likely an environmental problem with your server.  I would walk through all the steps called out in the guide for this issue.  If those don't work – then try some of these:

  • Connecting to WMI using WBEMTEST, root\cimv2 and seeing if there is a WMI issue.
  • Ensure WMI service is running.
  • Ensure OS is healthy and not experiencing severe memory pressure.
  • Reboot server
  • Run script manually:  copy the script from the \Program Files\System Center Operations Manager 2007\Health Service State\Monitoring Host Temporary Files\<numeric>\ location in the alert – to a local temp directory… then run it manually at a command prompt.  For instance – I search the “Monitoring Host Temporary Files directory for SCOMpercentageCPUTimeCounter.vbs to find a copy of the script, copy it to C:\temp\, and then run:  cscript.exe /nologo "SCOMpercentageCPUTimeCounter.vbs" servername.domain.com false 3.  Change the FQDN in this example to your actual servername FQDN you are testing it on.  This should return a XML propertybag that looks like:

image

 

If you don't get a XML propertybag returned – then something is broken…. you can look and see if you get an error returned, or if nothing…. then make sure you gave the script the correct expected parameters as above, then start debugging the script.

Another example I am seeing is the following:

The process started at 6:56:10 PM failed to create System.PropertyBagData. Errors found in output:

C:\Program Files\System Center Operations Manager 2007\Health Service State\Monitoring Host Temporary Files 2\1220\SCOMpercentageCPUTimeCounter.vbs(124, 5) Microsoft VBScript runtime error: ActiveX component can't create object: 'WbemScripting.SWbemRefresher'

This happens on Windows 2000 servers.  This note came from a reader comment:  It appears from http://msdn.microsoft.com/en-us/library/aa393838(VS.85).aspx that this Script API is only supported on Windows XP/Windows Server 2003 and up – so it is likely that this script will not work on Windows 2000 Servers.  If that is the case, you can disable this monitor AND rule for all Windows 2000 Computers, by overriding this monitor AND rule – for a group – and choosing the “Windows 2000 Server Computer Group”.  That should make these errors go away for old legacy systems you might still be monitoring.


Comments (33)

  1. Anonymous says:

    Hi there,

    I cannot seems to the find the fix tool as per the link posted. Anybody know where i can get it ?

  2. Kevin Holman says:

    Interesting!  Can you try using the tool I posted to disabled it, reboot, then enable it – and reboot – and see if it comes back?

  3. Anonymous says:

    Hi!

    We have a similar issue but instead of “Invalid Class” we get “The RPC server is unavailable”

    Here is the event alert:
    Microsoft.Windows.Server.NetwokAdapter.BandwidthUsed.ModuleType.vbs : The class name ‘Win32_PerfFormattedData_Tcpip_NetworkInterface Where Name =’VMware Accelerated AMD PCNet Adapter _2” did not return any valid instances. Please check to see if this is a valid WMI class name.. The RPC server is unavailable.

    When I run the script manually it works 9 out of 10 times.
    C:WINDOWSsystem32cscript.exe” /nologo “Microsoft.Windows.Server.NetwokAdapter.BandwidthUsed.ModuleType.vbs” server.mydomain true

    This happens on a few servers.

  4. Kevin Holman says:

    @Stewart –

    If 2008 R2 – make sure WMI isnt leaking memory per my other article.

    If not 2008 R2 – make sure cscript is updated to 5.7, and WMI is functional, then walk through the script and try and determin which steps are failing to return data.

  5. @HanJR: try removing the quotes ( " ) after cscript.exe – and make sure you have the VBS file in the right directory.

  6. Kevin Holman says:

    Make sure you disable the rule too!  🙂

  7. Kevin Holman says:

    Michael – it works on all my Server 2003 and 2008 machines, and I imagine it was developed on Server 2008.  I’m guessing there is some issue with your specific server?  So you get this error on multiple Server 2008 servers?

  8. Kevin Holman says:

    On:

    SCOMpercentageCPUTimeCounter.vbs(212, 2) SWbemObjectSet: Out of memory Assuming Issue with WMI

    SCOMpercentageCPUTimeCounter.vbs(125, 5) SWbemRefresher: No more threads can be created in the system. Assuming Issue with WMI

    I have seen both of these – and both times it appeared to be an issue with WMI.  It didnt need a WMI rebuild – it needed the WMI service restarted or a reboot of the OS.  Can you please find out on the majorty of systems with these errors – what OS are they running?  Also – how much memory (private bytes) are the WMI processes using in Task manager?

  9. Worked on most of my servers. In one case I had to stop winmgmt and run wmiadap /f.

  10. Kevin Holman says:

    Ramesh – you say that – but you didnt tell me what you tried???

    Do you have the WMI class present?

    Did you try the fix for that missing WMI class?

    Is your perf counter enabled for this?

  11. PatRick says:

    Thanks for that information!

    You should not have to reboot the server. it should be enough to restart WMI service.

  12. Radek says:

    Thank you for your great posts, you helped me in lot problem situations.

    Whe have the SCOMpercentageCPUTimeCounter.vbs failure too but our is a little diffrent. This failure appears on more W2K and W2K3 Servers.

    Maybe someone have an idea how to solve the ActiveX problem

    ———————————————–

    The process started at 8:49:04 AM failed to create System.PropertyBagData. Errors found in output:

    C:Program FilesSystem Center Operations Manager 2007Health Service StateMonitoring Host Temporary Files 112599SCOMpercentageCPUTimeCounter.vbs(124, 5) Microsoft VBScript runtime error: ActiveX component can’t create object: ‘WbemScripting.SWbemRefresher’

    Command executed: "C:WINNTsystem32cscript.exe" /nologo "SCOMpercentageCPUTimeCounter.vbs" testoapp01.cds.testo false 3

    Working Directory: C:Program FilesSystem Center Operations Manager 2007Health Service StateMonitoring Host Temporary Files 112599

  13. NJC1 says:

    Radek – I think your problem on the Windows 2000 servers is that the WbemScripting.SWbemRefresher object is only supported on Windows XP or higher – see the bottom of http://msdn.microsoft.com/en-us/library/aa393838(VS.85).aspx for more information.

  14. Radek says:

    NJC1 – Thank you for your note, yes that was the reason for my Windows 2000 Servers i disabled the monitor for the Windows Server 2000 Group

  15. Cooter Booter says:

    Ok, this is probably a newby question, but how do I find which Rule and Monitor trigger this alert?  The only one I see identified is the "Alert on Failed Batch Responses" rule which would obviously kill all batch process monitoring instead of just killing this specific script on Windows 2000 Server.

  16. Michiel Wouters says:

    @Cooter Booter

    The Alert Details show a workflow name. That’s what caused this alert.

    You can use the Operations Manager Shell (Powershell Extension) and execute the following:

    Get-Monitor | Where {$_.Name -eq "<workflowname>"

    In this case:

    Get-Monitor | Where {$_.Name -eq "Microsoft.SystemCenter.HealthService.SCOMpercentageCPUTimeMonitor"}

  17. Amaury Greiner says:

    Hi Kevin,

    is this actually a WIN2K-only problem?

    I have a open case at PSS, where my engineer recommended to update my MPs prior proceeding investigation. If yes, I could go into change in our enviroment (2003 and higher), since I do not need to enable those counters first.

    Thx in advance, Amaury

  18. Michiel Wouters says:

    Kevin,

    Got this same error on W2K8 servers:

    The process started at 6:56:10 PM failed to create System.PropertyBagData. Errors found in output:

    C:Program FilesSystem Center Operations Manager 2007Health Service StateMonitoring Host Temporary Files 21220SCOMpercentageCPUTimeCounter.vbs(124, 5) Microsoft VBScript runtime error: ActiveX component can’t create object: ‘WbemScripting.SWbemRefresher’

    Is this even supported on Server 2008?

    In this example, it’s clear Server 2008 is NOT supported, but it’s not clear this is because ‘WbemScripting.SWbemRefresher’ is used.

    http://gallery.technet.microsoft.com/ScriptCenter/en-us/be687ab9-e3a6-44ee-8159-bf11e81f16a2

  19. Rem-8 says:

    I got it also on Windows 2008 servers – they are Exchange 2007 ones

  20. Ramesh says:

    I'm also getting it on a Win 2008 server. Any ideas?

    C:Temp>cscript SCOMpercentageCPUTimeCounter.vbs servername.domain.com false 3

    Microsoft (R) Windows Script Host Version 5.7

    Copyright (C) Microsoft Corporation. All rights reserved.

    C:TempSCOMpercentageCPUTimeCounter.vbs(125, 5) SWbemRefresher: Invalid class

  21. Ramesh says:

    Kevin – Sorry I missed to mention what I checked, I do see the perf counter enabled but I don't see the WMI class 🙁 weir. It's a x64 bit server running Win 2008 STD x64 bit Edtn

  22. stephen says:

    i am having the same issues with the alerts but getting 4 versions of the errors

    SCOMpercentageCPUTimeCounter.vbs(124, 5) Microsoft VBScript runtime error: ActiveX component can't create object: 'WbemScripting.SWbemRefresher' – Disabled for Server 2000 Machines – Issue Resolved

    SCOMpercentageCPUTimeCounter.vbs(125, 5) SWbemRefresher: Invalid class  Followed article this resolve the issue

    SCOMpercentageCPUTimeCounter.vbs(212, 2) SWbemObjectSet: Out of memory Assuming Issue with WMI

    SCOMpercentageCPUTimeCounter.vbs(125, 5) SWbemRefresher: No more threads can be created in the system. Assuming Issue with WMI

    My question os should i rebuild the WMi DB?

    If anyone can help me it would be great

  23. stephen says:

    IBM X3950

    X64

    32GB Mem

    Server 2008 R2

    I found this article over the weekend and applied the hotfix. I think this has resolved my issue as 5 of the servers has not come back with any issues

    blogs.technet.com/…/wmi-leaks-memory-on-server-2008-r2-monitored-agents.aspx

    Thanks

  24. Yury Habets says:

    Kevin, I have one server at our customers' with the issue, and I noticed that all rules dealing with "Process" performance object are not collecting any data. This affects not only "agent processor utilization" workflows, but also w3wp.exe monitoring and so on.

    I've asked to apply the fix. I'll post back if everything is OK.

  25. Stewart Anderson says:

    Kevin, ive got an issue whereby this script returns

    The process started at 2:28:15 PM failed to create System.PropertyBagData, no errors detected in the output.  The process exited with 0

    Command executed: "C:Windowssystem32cscript.exe" /nologo "SCOMpercentageCPUTimeCounter.vbs" BACVSDWH01.domain.net false 3

    Working Directory: C:Program FilesSystem Center Operations Manager 2007Health Service StateMonitoring Host Temporary Files 11674

    One or more workflows were affected by this.  

    Workflow name: Microsoft.SystemCenter.HealthService.SCOMpercentageCPUTimeMonitor

    Instance name: BACVSDWH0.domain.net

    Instance ID: {BE9C744E-D538-DB04-6F2C-5AEF157DBFC0}

    Management group: BACSCOM

    The server has been rebooted and is functioing fine so not sure where to go?  If i manually run the script i get nothing back also.

  26. Alph says:

    Thanks a lot ! Good explanation and solution works like a charme 🙂

  27. Leigh S says:

    Hi

    Microsoft has removed the 2000 Resource kit from its download site.

    The same thing can be accomplished by modify the following registry value.

    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesPerfProcPerformance

    Disable Performance Counters from 1 to 0

  28. Joe says:

    I have been struggling with this script and trying to get it work.  It turns out that many of my servers had bigger problems with the performance counters.  To resolve them, I simply rebuilt them using:

    lodctr /r

    This seemed to take care of the issue.   Prior to executing this command, the script would hang for a very long time and then return an error.  Now, it returns what looks like XML in about 30 seconds.

  29. HanJR says:

    HanJR

    HI Kevin,

    I checked all sources, erverthing seems fine but when I try to run a script I get the following error:

    WIN2008R2

    C:temp>cscript.exe" /nologo "SCOMpercentageCPUTimeCounter.vbs" server.mydomain.net false 3

    The system cannot find the path specified.

  30. Bhaskar G says:

    Hi :We are facing issue with BizTalk2013 folder monitoring . SCOM server running with SCOM 2012 Sp1 and using File and Folder Monitoring MP

    The process started at 13:51:00 failed to create System.Discovery.Data. Errors found in output:

    C:Program FilesSystem Center Operations ManagerAgentHealth Service StateMonitoring Host Temporary Files 1168532222FolderDiscovery.vbs(76, 8) Microsoft VBScript runtime error: Path not found

    Command executed: "C:Windowssystem32cscript.exe" /nologo "FolderDiscovery.vbs" {28E026F6-668D-1CC7-2FA8-4172A3F2493D} {80270AE0-BAE0-4B3F-CB73-F10EBFE2A4E3} BIZTALK2013.xxxx.com BIZTALK2013.xxxx.com "D:Files"
    Working Directory: C:Program FilesSystem Center Operations ManagerAgentHealth Service StateMonitoring Host Temporary Files 1168532222

    One or more workflows were affected by this.

    Workflow name: Windows.Monitoring.FileSystem.Folder.Discovery
    Instance name: Files
    Instance ID: {80270AE0-BAE0-4B3F-CB73-F10EBFE2A4E3}
    Management group: xxxxx

  31. OdgeUK says:

    Useful article, thanks. We see this alert a lot in our 2012 R2 environment. On investigation, it seems to be coming from mainly boxes running the free non-gui version of Hyper-V Server. Looking on those boxes, the PerfProc DLL is disabled. not sure if
    this is by design on this OS, but when I enabled it on the first box I very quickly got a new alert for:

    "Too many requests for performance counter data have timed out:
    The performance data collection function "PerfProc" in the "C:Windowssystem32perfproc.dll" library did not complete in the allowed time. There may be a problem with this extensible counter, the service from which the counter is collecting data, or the system
    may have been very busy when this call was attempted."

    For now i am overriding both the Rule and Monitor for all objects of the class ‘Server Running Hyper-V 2008’. Sadly there doesn’t seem to be class in SCOM JUST for the non-GUI free version of this OS, so our override extends to servers which aren’t really impacted,
    which is a shame.