UPDATE 8/15/2018 – The transform tool is no longer available, however a simpler version of this tool from Tim McFadden is:
Quick Download: https://github.com/timmcfadden/SCOM-Transform-Tool/releases/download/1/Transform.zip
I wrote about basic discovery script troubleshooting here: https://kevinholman.com/2010/03/09/basic-troubleshooting-of-scom-discovery-scripts/
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 Transform Tool from Tim
This handy tool will allow us to copy out the script from the XML management pack, past it into the text area, and then click “UnEscape” to convert the file:
Which will convert this:
To this:
Now you can copy out your converted script into a script file to test at the command line.
Tim McFadden Transform tool moved:
https://github.com/timmcfadden/SCOM-Transform-Tool