Task Sequence variables disappear in later steps
Hello, I have a simple script at the beginning of a task sequence that sets some variables in WinPE. I echo these out so I can see the correct values were saved: Set TSEnv = CreateObject("Microsoft.SMS.TSEnvironment") TSEnv("OSDComputerName") = NewName TSEnv("OldComputerName") = OldName WScript.Echo "OSDComputerName=" & TSEnv("OSDComputerName") WScript.Echo "OldComputerName=" & TSEnv("OldComputerName") But then later, after Win7 is installed, I echo the same variables and they are blank: Set TSEnv = CreateObject("Microsoft.SMS.TSEnvironment") WScript.Echo "OSDComputerName=" & TSEnv("OSDComputerName") WScript.Echo "OldComputerName=" & TSEnv("OldComputerName") Accoding to TechNet these variables should be available to all steps in task sequence: http://technet.microsoft.com/en-us/library/bb693541.aspx http://technet.microsoft.com/en-us/library/bb632442.aspx The early step runs as system in WinPE, and the later step runs as a domain user in Win7, not sure if that matters. Any ideas what is resetting these or why they are blank?
June 16th, 2011 5:36pm

Are you saying the second step above is run during the task sequence after the Setup Windows and ConfigMgr task? Also, are you saying that you are running the second step above using a Run command-line task and the Run As alternate user functionality? If yes to both of these, then there is a known limitation that prevents the task sequence variables from being accessed under alternate contexts; i.e., when you use the run as function in the run command-line task. If you need to pass values to a command-line and use alternate credentials, you should pass them as parameters on the command-line; e.g., in the case of a batch script: myscript.bat %OldComputerName% %OSDComputerName% and then refer to these as %1 and %2 in the script itself. A similar technique can be used for VBScript or PowerShell also.Jason | http://myitforum.com/cs2/blogs/jsandys | Twitter @JasonSandys
Free Windows Admin Tool Kit Click here and download it now
June 16th, 2011 8:31pm

Thanks, that seems to be the case, if the step runs without alternate credentials it works fine. I searched on this, but didn't find anything. Thanks for replying, you know more than TechNet :)
June 17th, 2011 4:11pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics