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")
On Error Resume Next
If trim(Wscript.Arguments.Item(0)) <> "" Then
Wscript.echo "No TS variables were passed for the script-" & Wscript.ScriptFullName
If Err.number <> 0 then
Wscript.echo "Error Writing the variable." & Err.Description
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.