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:
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! See you next time… and remember to connect with me @RecastSoftware on Twitter.
See more tips:
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: