Quite a few people have been hit by an issue where statview.exe, or the status message viewer in ConfigMgr2007 is taking 99 or 100% cpu and is taking a long time before displaying the status messages. The general fix for this has been to open the taskmanager and to set the process priority of the Sccm statview.exe to "Below Normal".
Below you'll find a script to set the status of these processes by vbscript. (Vbscript gladly re-used, with very minor modifications from this blog from the scripting guys, credit where credit is due, thanks guys.)
Now, the script is nice in and by itself, but still requires you to run it every time you open the status message viewer. That's where WmiEventing comes in, lets just create a scripteventconsumer that modifies the process priority each time it is launched.
The active script event consumer allows you do define a filter, where we filter on process creations using the __instancecreationevent class.
In here we filter on processes named statview.exe.
Subsequently, we create an activescripteventconsumer, that embeds the above script from the scripting guys.
Lastly we bind the filter to the activescripteventconsumer.
Below, you'll find the mof to have this implemented, just compile on any machine that has the ConfigMgr admin console by running Mofcomp -Autorecover statviewfix.mof
You can download the mof file here: http://cid-2c4ac2127eae73d5.office.live.com/self.aspx/Public/bloglinks/statviewfix.mof
#pragma namespace ("\\\\.\\root\\subscription")
instance of ActiveScriptEventConsumer as $Cons
Name = "StatviewFix";
ScriptingEngine = "VBScript";
ScriptText = "Const BELOW_NORMAL = 16384\n\n"
"Set objWMIService = GetObject(\"winmgmts:\\\\.\\root\\cimv2\")\n\n"
"Set colProcesses = objWMIService.ExecQuery(\"Select * from Win32_Process Where Name = 'statview.exe'\")\n"
"For Each objProcess in colProcesses\n"
"\t objProcess.SetPriority(BELOW_NORMAL) \n"
instance of __EventFilter as $Filt
Name = "EF";
EventNamespace = "\\\\domc02\\Root\\Cimv2";
Query = "SELECT * FROM __InstanceCreationEvent WITHIN 2 "
"WHERE TargetInstance ISA \"Win32_Process\" "
"AND TargetInstance.Name = \"statview.exe\"";
QueryLanguage = "WQL";
instance of __FilterToConsumerBinding
Filter = $Filt;
Consumer = $Cons;
Const BELOW_NORMAL = 16384
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'statview.exe'")
Each objProcess in colProcesses
Enjoy the dive into the Dark Magic of WMI.
"The M in WMI stands for Magic"
Kim Oppalfens - Sms Expert for lack of any other expertise
Windows Server System MVP - SMS
del.icio.us Tags: SCCM,ConfigMgr,Wmi Eventing
Technorati Tags: SCCM,ConfigMgr,Wmi Eventing