Scripting Overview

Microsoft® Operations Manager (MOM) 2005 provides scripting capabilities for flexible, customized monitoring and response to events, alerts, and performance data. You can use the MOM scripting interface or standard Microsoft scripting languages to create scripts that MOM can implement. Scripts can extend MOM event management functions and provide additional data collection capabilities. MOM can also implement response scripts for events or alerts or do so on a scheduled basis.

The MOM scripting feature allows you to extend the capabilities of rules and provide specialized actions to respond to an event, alert, or performance threshold. Rules can also be configured to run on a scheduled basis.

MOM can run scripts in association with rules. Because MOM is rules-based, many problems can be detected and handled without using scripts. Scripting provides the advanced capabilities sometimes required to detect and handle problems.

MOM uses Microsoft Active Scripting through scripts and Automation COM objects. MOM invokes Active Scripting, identifies the language of the user-provided script, and then calls the appropriate scripting engine. For scripts that use either Microsoft Visual Basic Scripting Edition(VBScript) or Microsoft JScript®, the language is specified on the Generaltab of the script's Propertiesdialog box. For all other languages, the Customsetting must be selected and the script engine must be specified by adding a line (similar to the following example) to the first line of the script.


Including the shebang line causes errors, unless the Customlanguage type is used. To determine the appropriate name (ProgID) to use when calling a specific scripting engine component, consult the documentation for that script engine.

The custom scripting engine must be installed on all computers where the script will run.

The script runs and interacts with MOM through Automation COM objects. The script can also use other Automation COM objects. You can write scripts using any active scripting language, including VBScript, JScript, and Perl.

Script developers should be aware that objects automatically provided to scripts running in the Microsoft Windows® Script Host environment, such as the WScriptobject, are not present in the MOM scripting runtime. The WScriptobject is available only to scripts executed by the Cscript.exe or Wscript.exe applications. Calling the WScript.Echomethod or other WScriptmethods in a MOM script results in script errors. Similarly, MOM scripting objects are not meant to be used outside of the MOM scripting environment and runtime. Using MOM scripting objects in other environments, such as the Windows Script Host, is unsupported.

Note  Note   

Use of the objects described in the Helper objects section is strongly discouraged. In most cases, identical or similar functionality is available through existing Windows Management Instrumentation (WMI) classes or COM libraries that are included with Windows or other Microsoft products.

MOM scripts run within an instance of the MOMHost.exe process. The MOMHost.exe process and scripts run under the MOM Action account, which is used to control their security privileges.

Scripts are stored in the MOM database and distributed with rules by the Agent Manager. Management Pack modules can contain scripts created for a specific application or environment. Open the source code for scripts included with MOM Management Packs from the Scripts node of the MOM Administrator console. View the source code on the Scripttab of the script's Propertiesdialog box.

Note  Note   

For developer-oriented information about creating custom Management Packs, programming reports, extending the MOM Administrator console, and creating connectors to other management products, see the documentation and code samples in the MOM Software Development Kit (SDK).