Troubleshooting SCOM discovery scripts – and those annoying XML special characters


 

I wrote about basic discovery script troubleshooting here:  http://blogs.technet.com/b/kevinholman/archive/2010/03/09/basic-troubleshooting-of-discovery-scripts.aspx

 

One of the pains when needing to troubleshoot a Discovery script, is getting the script extracted from the management pack in a runnable format.

The challenge is, there are characters used in VBScript, that are not allowed in XML.  These are called XML Reserved Characters:

http://technet.microsoft.com/en-US/library/ms145315(v=SQL.90).aspx

When the script is added to a XML document, these characters are “escaped” or converted to a XML allowed format.  However, when we crack open the XML and copy out the script for troubleshooting, we cannot run it directly in cscript, because cscript does not allow these characters.

One of the old methods was to browse to the SCOM agent directory, in the Health Service State\MonitoringHost Temporary Files folders, and find the scripts there, which had been converted by the agent.  The problem is, not all of the scripts persist here.  If they are run on a scheduler interval, and don’t have an on-demand probe action associated with them, they will show up for a millisecond, then get deleted.

What we need, is a tool, that will “UnEscape” these characters for us.

Enter in TransformTool from codeplex:    http://transformtool.codeplex.com/

This handy tool will allow us to copy out the script from the XML management pack, past it into the text area, and then double-click “XML Unescape” to convert the file:

image

Which will convert this:

image

To this:

image

Now you can copy out your converted script into a VBS to test at the command line.


Comments (3)

  1. Kepp says:

    Well done my man. Well done.

  2. Kepp says:

    Well done my man. Well done.

Skip to main content