For those times when you need to find out what a variable is set to while running a task sequence, you can run a simple script along with the variable name that you would like to check the value for. As long as the task sequence environment is available and the variable’s value is set to something other blank, it should return the value.
Dim sTSVar, sParameters, oTSEnv, Wsh Set oTSEnv = CreateObject("Microsoft.SMS.TSEnvironment") Set Wsh = CreateObject("Wscript.Shell")
Sub Main() On Error Resume Next
If trim(Wscript.Arguments.Item(0)) <> "" Then DisplayVariables Wscript.Arguments.Item(0) Else Wscript.echo "No TS variables were passed for the script-" & Wscript.ScriptFullName End If If Err.number <> 0 then Wscript.echo "Error Writing the variable." & Err.Description End If End Sub
Sub DisplayVariables(sParameters) Wscript.Echo oTSEnv(sParameters)
Let’s say you named your script readtsvar.vbs. While the task sequence was running you could hit F8 to open a command window and simple run the following:
cscript readtsvar.vbs OSDComputerName
This would return whatever the computer name variable is currently set to.
How can you hardcode OSDComputerName into that script. All I ever want to do with this script is see the OSDComputerName.