I am trying to assign a value to a task sequence variable. I've created the Microsoft.SMS.TSEnvironment object, I've verified it's a valid object, but when I try to assign it a value, I get "Expression continues past expected end. I'm using a Winbatch variables for both my task sequence variable name and value. I thought that might be a problem, so I tried hardcoding the name and value. No joy. Why is this happening to me? Is there a better way to verify that this object is legit?
#DefineFunction UDF_CreateTSVariable(vstrTSVariable,vstrValue)
; Set the program to goto the WBErrorHandler function if there is a problem.
IntControl(73,3,0,"UDF_WBErrorHandler",0)
; Resume DebugTrace (if it was already active)
DebugTrace(22)
vobjTSE = CreateObject("Microsoft.SMS.TSEnvironment")
vintObjectType = VarType(vobjTSE)
If (vintObjectType & 1536) != 1536 || vintObjectType == 0 Then
Return(@FALSE)
Else
vobjTSE(vstrTSVariable) = vstrValue
If StriCmp(vobjTSE(vstrTSVariable),vstrValue) == 0 Then
Return(@TRUE)
Else
Return(@FALSE)
End If
End If
#EndFunction