Getting Started Developing Runtime Scripts

Updated: January 31, 2012

Applies To: System Center 2012 - Operations Manager

To develop a runtime script, your development computer must contain a registered copy of the Operations Manager Script library. For more information, see About the Operations Manager Script Library.

Developing a runtime script involves the following tasks:

  • Creating a runtime script

  • Testing and debugging the script

  • Adding the script to a Management Pack

These tasks are described in the following sections.

Creating a Runtime Script

You can develop a runtime script in any authoring environment and in either of the following supported scripting languages:

  • JScript

  • VBScript

  • Windows PowerShell

When you are authoring a runtime script, first create an instance of the MOMScriptAPI object. This is the top-level object in the scripting library, which you can use to create either discovery data or monitoring data. A runtime script can return only one type of data—either discovery data or monitoring data—but not both. For more information about the objects that are included in the Operations Manager Script library, see Operations Manager Scripting Objects.

For more information and script examples, see the following:

How to Use Runtime Scripts for Discovery

How to Use Runtime Scripts for Monitoring

Testing and Debugging the Script

You can test an Operations Manager runtime script from a command line, outside of the Operations Manager runtime environment. When the script runs, any output data that is generated by the script can be displayed in a console window as an XML string. This makes it possible for you to verify that the script is collecting the appropriate data, before you incorporate the script into a management pack.

Runtime scripts can also write events to the Operations Manager event log, which can provide information about anticipated errors that occur while the script is running. For more information, see How to Create Operations Manager Events by Using a Script.

If you encounter any problems with a script, you can debug it using any script debugger. For more information, see Debugging Runtime Scripts.

Adding the Script to a Management Pack

To use a runtime script in Operations Manager, you must add the script to a management pack. The script then runs automatically during regular discovery or monitoring operations. Possible methods of incorporating a script into a management pack include the following:

  • Creating a new data source module type that allows you to use the script to collect data for a discovery, monitor, rule, or task

  • Adding the script to a specific discovery, monitor, rule, or task.

For more information, see How to Use Discovery Data in a Management Pack and How to Use Monitoring Data in a Management Pack.

See Also