Microsoft Operations Manager |
The getmethod gets a variable value from the VarSetobject.
[VBScript] VarSet.get(VariableName
String)
Variant
The following example shows how to use a VarSetobject to store data between script sessions.
[VBScript]
Function IncrementCriticalErrors()
Const ERROR_VARSET_NAME = "Error Tracker"
Const NORMAL_ERROR_COUNT = "Number of Errors"
Const CRITICAL_ERROR_COUNT = "Number of Critical Errors"
Dim objScriptState
Dim objErrorVarSet
Dim vntCriticalErrors
Set objScriptState = ScriptContext.GetScriptState()
Set objErrorVarSet = objScriptState.GetSet(ERROR_VARSET_NAME)
' get and modify count values
vntCriticalErrors = objErrorVarSet.get(CRITICAL_ERROR_COUNT)
vntCriticalErrors = CLng(vntCriticalErrors) + 1
' save variable changes back to the VarSet
Call objErrorVarSet.put(CRITICAL_ERROR_COUNT,
vntCriticalErrors)
' save the VarSet
Call objScriptState.SaveSet(ERROR_VARSET_NAME, objErrorVarSet)
Set objErrorVarSet = Nothing
Set objScriptState = Nothing
IncrementCriticalErrors = CLng(vntCriticalErrors)
End Function
Windows NT/2000: Requires Windows 2000 or later
Version: Requires MOM 1.0 SP1
VarSet Object, VarSet.put Method
Did you find this information useful? Please send your suggestions and comments about the documentation to momsdk@microsoft.com.