SCOM: Monitoring the WSH Version on Windows Agents
August 14, 2009 2 Comments
Given the severe performance issues that can be caused by SCOM monitoring on hosts without the Windows Script Host 5.7, and the possibility that WSH 5.7 binaries can be replaced with older versions by Windows File Protection (http://support.microsoft.com/default.aspx/kb/955360), I’ve found it useful to use a SCOM unit monitor to monitor managed agents for the expected WSH version (5.7 or later).
The script that I’ve written for this purpose first checks the OS Caption with WMI (to exclude 64bit hosts from the check) and then checks the version of cscript.exe using a WSH FileSystemObject.
set oFSO = CreateObject(“Scripting.FileSystemObject”)
sFileVersion=oFSO.GetFileVersion(sWinDir & “\system32\cscript.exe”)
To deploy this as a unit monitor, create a two-state timed script monitor. Set the unhealthy state expression to: Property[@Name=’status’] equals Error and the healthy state expression to Property[@Name=’status’] equals OK.
A message with a description of the problem and the current cscript.exe version can be added to the alert with the $Data/Context/Property[@Name=”Message”]$ Xpath string.