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 Next
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.
183 Microsoft Team blogs searched, 87 blogs have new articles in the past 7 days. 205 new articles found
So apologies to all - credit to Frank Rojas for discovering this. The posted script had a typo - it was using a curly quote instead of straight quote and was probably when it was copied and pasted. Remember there is also a new and improved version in the second installment of this post.
I've tried putting this on a network share and calling from a task sequence, but it's not really working for me. It had a probem with this line "<script language="VBScript" src="ZTIUtility.vbs"/>" and even when removed, I couldn't find OutputTSVariables.log anywhere. I even tried outputting to a text file from the vbs, but it's always empty.
All I'm really looking for is a way in the task sequence to map a drive to the local DP. It shows up in smsts.log and I've found references to %SMSDP% but it doesn't work. Help?
I tried to implement something very similair but in Powershell and got lost. Are you able to provide the same script snippet in Powershell?
Here is my first part to get the variables. I am able to create a list of variables but what is the syntax to get the values?
$TSEnv=New-Object -comobject Microsoft.SMS.TSEnvironment"
foreach ($TSVar in $TSEnv.GetVariables()
$TSVar #That's only the name!!
$TSVar._SMSLogPath # VALUE ?!????
Another issue is I want to set application variables. The problem is the same. I am not sure about the Syntax. In a VBScript
$TSVar("OSDComputerName") works. But what about Powershell?
$TSEnv.Variable=xvz or can I access the variables via the standard $env variable?
Any suggestion would be nice.
When troubleshooting TS’s or when you simply want to know what is all being used in the TS, it can be
I realize that this is 2 years old, but this is exactly what I'm looking for (I think). I've downloaded the OutputTSVariable script and copied it to my Toolkit package (and updated my distribution point), but I don't know what do do now.
What do I do to my task sequence to execute this script?
Seems there is a disconnect. Where are we initializing "oLogging" object before we can call "oLogging.CreateEntry". I can't see what can this object can possibly be and what is the ", LogTypeInfo" doing there. Someone has to revisit this article and write probably few more lines to make all these meaningful.
PK, the oLogging object is initialized in ZTIUtility.vbs (a collection of utility classes used by most MDT scripts). As you can see the attached MDT-style script references this in the line "<script language="VBScript" src="ZTIUtility.vbs"/>". ZTIUtility.vbs must be in the same folder as the attached script for this to work.