Microsoft Operations Manager

State Object

The Stateobject is a named instance of the VarSetobject that contains values set through a MOM rule with the Update a State Variableresponse type. As a response to an event, alert, or performance measurement, you can save and edit state information in the Stateobject. You can then access this state information from scripts.

There are different types of state operations. Most state operations edit a variable by incrementing it, decrementing it, or setting it to a specific value. State operations include the following:

These operations make the variable specified in the State variable namefield available to scripts through the Stateobject.

The Store the last N occurrencesoperation creates the following variables with the state variable root:

Set the operation, values, and name and root fields for state operations with the State Variable Update Operationwindow.

Examples

The following example shows how to access the number of times an event occurred after setting a state response to increment the LogonViolations.Count state variable name.

[VBScript] 
Function GetNumberOfLogonViolations()
	Dim vntCount

	vntCount = State.get("LogonViolations.Count")
	GetNumberOfLogonViolations = CLng(vntCount)
End Function

The following example shows how to access the last occurrence of the logon domain after setting a state response to record the last 50 occurrences of the Logging Domain variable with the LogonViolations.LoggingDomain state variable root.

[VBScript] 
Function GetLastDomain()
	Dim vntLastDomain, vntLastOccurrence

	vntLastOccurrence =
State.get("LogonViolations.LoggingDomain.last")
	vntLastDomain = State.get("LogonViolations.LoggingDomain."
& vntLastOccurrence)
	GetLastDomain = CStr(vntLastDomain)
End Function

Requirements

Windows NT/2000: Requires Windows 2000 or later
Version: Requires MOM 1.0 SP1

See Also

VarSet Object


Did you find this information useful? Please send your suggestions and comments about the documentation to momsdk@microsoft.com.