Using Task Sequence Variables to make life a bit easier in ConfigMgr 2007

Sometimes you think you’ve got it all, so you start looking for things to make it better and easier. Well…, to be honest I’m not even close to having it all, but I am looking to make things better and easier. This is why I started looking more on using Task Sequence Variables, because they can make life a whole lot easier. In this post I will use a Task Sequence Variable to prevent the need of building two separate Task Sequences.

Let’s start with telling the scenario. I have a Task Sequence that I use for a computer-refresh by using hard-links (take a look at thisprevious post). Now I want to use the same Task Sequence to perform a clean install.TSVariable Of course it’s easy to just say, like in the default Install Task Sequence, that the step of Capture User Files and Settings only has to run when _SMSTSInWinPE equals TRUE. The only problem for me with this is that you have to set the step Restore User Files and Settings to Continue on error. I only want an error when there is really something wrong, not just because the Task Sequence can’t locate a store that doesn’t exist…

This is where the fun starts and where it makes sense to create a Task Sequence Variable. In this scenario the computer-refresh can only be started in FullOS, so when the Task Sequence gets started from WinPE it is not needed/ possible to perform a computer-refresh. This is why the first step in my Task Sequence (red arrow) only creates a Variable when _SMSTSInWinPE equals TRUE. I create here a Variable called CaptureRestoreUserFilesSettings with the value NO. Now I can use this Variable in the rest of the Task Sequence to decide whether or not some steps have to run. The steps Capture User Files and Settings and Restore User Files and Settings (first and third red rectangle) will only run when my Variable CaptureRestoreUserFilesSettings not equals NO. So that’s always except for when the Task Sequence started from WinPE. It’s not necessary to give the Variable a different value when the Task Sequence is running in FullOS, because when the Variable doesn’t exists it can’t equal NO either (nice and cryptic).  The step Partition Disk 0 (second red rectangle) will only run when CaptureRestoreUserFilesSettings equals NO. So that’s only when the Task Sequence is started from WinPE.

This same construction can of course be used in many different ways and scenario’s, all I tried to do is showing an example. To conclude this story, I don’t say that you have to use Task Sequence Variables, but I do say that it can make your life a lot easier.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.