Microsoft Operations Manager

put Method

The putmethod saves a variable value in the VarSetobject.

[VBScript] VarSet.put(VariableName
String, Value Variant)

Parameters

VariableName
Specifies the name of the variable value to save to the VarSetobject.
Value
Specifies the variable value to save to the VarSetobject.

Return Value

None

Examples

The following example uses the getand putmethods to update a value stored in a VarSetobject.

[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

Requirements

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

See Also

VarSet Object, VarSet.get Method


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