A Week of Task Sequence Tips – Day 03 – Variables Gather and Capture

We reached tip three, what tip do I have up my sleeve today? One word: Variables. You use them more than you might think. Many of you come to expect and rely on, but then you uninstalled MDT, or didn’t install it in your new ConfigMgr setup, and your Task Sequence steps started to fail.

The Community has created a great script that auto generates a ton of useful variables, and I’ve implemented it in all of my task sequences. The script is also useful when you want to figure out how this information was gathered, as the creator of the script is a guru at powershell and you can learn a far amount from the script itself. Here are some of the additional variables created:

  • Architecture
  • AssetTag
  • BIOSReleaseDate
  • BIOSVersion
  • DefaultGateway
  • IPAddress
  • IsDesktop
  • IsLaptop
  • IsOnBattery
  • IsServer
  • IsVM
  • MacAddress
  • Memory
  • Model
  • OSCurrentBuild
  • OSCurrentVersion
  • ProcessorSpeed
  • Product
  • SerialNumber
  • UUID
  • Vendor
  • VMPlatform

So now you’ve got lots of variables, and you’re trying to set your own. You want to confirm that they are set, and that they are what you’re expecting. You can either than Pause the Task Sequence, (like we talked about in the last post) launch powershell and read the variables, or run a script that dumps all the variables to a log file. Nice thing is, this script skips sensitive variables that might include passwords and gives you the peace of mind that if someone opens the log, they won’t find any info that you’d consider risky.

So what does this look like in the Task Sequence?

Gather Script
Gather Script
Dump Variable Script
Dump Variable Script

And the Output?

TSVariables Logs
TSVariables Logs

The Script create a log file in the SMSTSLog folder, which gets commmited to the logs folder after the TS is completed.

Bonus.. registry keys..

Ever want to check a registry key value at a specific time… write the value to a task sequence variable! Then you can read that variable.

This step grabs the Value of a Specific Key and places it in a TS Variable
This step grabs the Value of a Specific Key and places it in a TS Variable

So that was a nifty tip, creating variables, outputting variables to a log file, reading registry keys into variables, that’s handy stuff! See you next time… and remember to connect with me @RecastSoftware on Twitter.

See more tips:

Tag Version in Description

Task Sequence Pause

SMSTS Log Stamping

Run Task Sequence Step

Static IP Addresses and OSD

Run PowerShell Step

See how Right Click Tools are changing the way systems are managed.

Immediately boost productivity with our limited, free to use, Community Edition.

Get started with Right Click Tools today:


  • This field is for validation purposes and should be left unchanged.


  • This field is for validation purposes and should be left unchanged.

By submitting this form, you understand that Recast Software may process your data as described in the Recast Software Privacy Policy.