ScriptContext Object

Use the ScriptContext object to access and manipulate MOM alerts, events, performance data, and variable sets.

The ScriptContext object is automatically instantiated by the MOM scripting environment. The ScriptContext object can be considered the root object for MOM scripts. The ScriptContext object is capable of creating all of the other product objects by using methods, such as ScriptContext.CreateAlert, or through the return value of properties, such as the ScriptContext.Alert property.

Methods

Name Description

CreateAlert

Generates a new Alert object.

CreateDiscoveryData

Generates a new DiscoveryData object.

CreateEvent

The CreateEvent method generates a new Event object.

CreatePerfData

Generates a new PerfData object.

Echo

When called in a response, this method writes messages to a text file for debugging purposes.

GetOverride

Gets the specified override for the current rule.

GetScriptState

Gets the ScriptState object.

IsAlert

Determines whether the object provided to the script by MOM is an Alert object.

IsEvent

Determines whether the object provided to the script by MOM is an Event object.

IsPerfData

Determines whether the object provided to the script by MOM is a PerfData object.

Quit

Stops the running of the script and exits.

Sleep

Suspends the running of the script for the specified number of seconds.

Submit

Submits an Alert, Event, PerfData, or DiscoveryData object to the MOM data stream.

Properties

Name Description

Alert

Gets the Alert object that caused MOM to invoke the script.

Event

Gets the Event object that caused MOM to invoke the script.

IsTargetAgentless

Checks whether the computer is monitored without a MOM agent or not.

IsTargetVirtualServer

Gets a Boolean value indicating whether the computer is running as a Windows Server Cluster server or not.

ManagementGroupName

Gets the name of the management group that deployed the current response.

Name

Gets the name of the current script.

ProcessingRule

Returns the processing rule that invoked the current response script.

Parameters

Gets a VarSet object that contains the parameters sent from MOM when the script was invoked.

PerfData

Gets the PerfData object that caused MOM to invoke the script.

TargetComputer

Gets the name of the computer being monitored.

TargetComputerIdentity

Gets the identity of the target computer for the current script response.

TargetNetbiosComputer

Gets the target computer's NetBIOS name.

TargetNetbiosDomain

Gets the target computer's NetBIOS domain name.

TargetFQDNComputer

Gets the target computer's fully-qualified domain name.

Requirements

Platforms: Requires Windows 2000 or later

Version: Requires MOM 2000  or later