Debugging Runtime Scripts
Applies To: System Center 2012 - Operations Manager
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
You can test and debug runtime scripts outside of the Operations Manager runtime environment.
To test a script, you can run it from a command line by using CScript.exe (the command-line version of the Windows Script Host). Any output that is generated by the script is displayed in the command window, which you can use to verify that the script is generating the appropriate results. If you discover issues with the script, you can debug it by using a scripting debugger.
For more information about debugging scripts, see the Script Center on Microsoft TechNet.
Getting Information About Runtime Errors
If a runtime error occurs in a script that is used by an installed management pack, the Operations Manager agent adds an event describing the error to the Operations Manager event log. Categories of possible runtime errors include the following:
The script failed with a script error.
The script exited without providing the required output data (discovery or property bag data).
The script's output data was not valid.
The script was in the queue for too long a time.
The script ran past the timeout.
The process was stopped due to system or health service shutdown.
Script errors are written to debugging out that you can examine with a tool, such as dbmon.exe.
The On Error Resume Next and Try…Catch statements are not recommended unless the script includes a handler that is specifically designed for these errors.
You can also add custom information about scripting errors to the event log by using the MOMScriptAPI.LogScriptEvent method. For more information, see How to Create Operations Manager Events by Using a Script.
See Also
Concepts
Getting Started Developing Runtime Scripts
Runtime Scripts Overview