When debugging a MDT based Configuration Manager Task Sequence, it is often helpful to know what certain built-in Configuration Manager variables are set to during a step in the task sequence. For instance, you may want to see if _SMSTSLastActionRetCode was equal to a certain value or perhaps which management point the client is using by checking _SMSTSMP. These variables and more are available in the Microsoft.SMS.TSEnvironment and you can easily log them using the script snippet below:
Set osdV4 = CreateObject("Microsoft.SMS.TSEnvironment")
For Each sVar in osdv4.GetVariables()
oLogging.CreateEntry sVar & ":" & oEnvironment.Item(sVar), LogTypeInfo
A list of the variables and their values can be found at http://technet.microsoft.com/en-us/library/bb632442.aspx .
The full ZTI-style script is included below. Add the script to the Microsoft Deployment Toolkit package and you can call this script as a task in the task sequence. The variables will be outputted to OutputTSVariables.log.
Try it out and feel free to comment.
This post was contributed by Aly Shivji a consultant with Microsoft Services - U.S. East Region.