Welcome to TechNet Blogs Sign in | Join | Help

Logging All the Configuration Manager Task Sequence Variables

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:

Dim sVar

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.

Published Friday, August 29, 2008 4:31 PM by DeploymentGuys
Attachment(s): OutputTSVariables.zip

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# BlogMS Weekly Articles Published - 25th August 2008 to 31st August 2008

Monday, September 01, 2008 4:25 AM by BlogMS - Official Microsoft Team Blogs

183 Microsoft Team blogs searched, 87 blogs have new articles in the past 7 days. 205 new articles found

# BlogMS Weekly Articles Published - 25th August 2008 to 31st August 2008

Monday, September 01, 2008 6:56 AM by BlogMS - Official Microsoft Team Blogs

183 Microsoft Team blogs searched, 87 blogs have new articles in the past 7 days. 205 new articles found

# re: Logging All the Configuration Manager Task Sequence Variables

Thursday, October 09, 2008 9:55 AM by DeploymentGuys

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.

# re: Logging All the Configuration Manager Task Sequence Variables

Thursday, October 16, 2008 12:37 PM by Dave

Hi,

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?

Thanks,

Dave

# re: Logging All the Configuration Manager Task Sequence Variables

Thursday, September 17, 2009 5:36 AM by Joachim

Hi

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")=xyz

$TSEnv.Variable=xvz or can I access the variables via the standard $env variable?

$env:Variable

Any suggestion would be nice.

Best Regards

Joachim

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker