Author Topic: Assigning value to object nets "Expression continues past expected end"  (Read 825 times)


  • Jr. Member
  • **
  • Posts: 68
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?

Code: [Select]
#DefineFunction UDF_CreateTSVariable(vstrTSVariable,vstrValue)

; Set the program to goto the WBErrorHandler function if there is a problem.

; Resume DebugTrace (if it was already active)

vobjTSE = CreateObject("Microsoft.SMS.TSEnvironment")
vintObjectType = VarType(vobjTSE)
If (vintObjectType & 1536) != 1536 || vintObjectType == 0 Then
vobjTSE(vstrTSVariable) = vstrValue
If StriCmp(vobjTSE(vstrTSVariable),vstrValue) == 0 Then
End If
End If



  • Tech Support
  • *****
  • Posts: 2157
    • WinBatch
Re: Assigning value to object nets "Expression continues past expected end"
« Reply #1 on: January 27, 2016, 07:59:22 am »
You are attempting to use VB syntax in WinBatch.  WinBatch does not support magic-default-object-method syntax (something that some of the original VB implementers now admit was a mistake.)  So you need to figure out the name of the actual method being called when you attempt the assignment.  One way to do that is to use the WIL Type Viewer to examine the classes and objects involved.   
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates