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.
Tip 3: Variables Gather and Capture
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:
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?
And the Output?
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.
So that was a nifty tip. Creating variables, outputting variables to a log file, reading registry keys into variables—that’s handy stuff! Check out the other posts in the “A Week of Task Sequence Tips” series below, and remember to connect with me @RecastSoftware or learn more at Recast Software.