In this article I will teach you what task sequence variables are and how you can use them to there full power in deploying operating systems.
By using variables you can customize your task sequence to do things such as
- Assign a computer name to the machine being built
- Only apply device drivers to the correct hardware
- Apply regional settings
- Only install required applications
And much more.
There are two main types of variables, Built-in and custom
Build-in variables are part of the task sequence and contains information about the running task sequence. For a full list of built-in variables take a look at the microsoft documentation
Custom Variables
By creating custom variables we can customise the task sequence for our needs. We can do things such as
- Prompt to enter a computer name
- Apply regional options per region
- Install apps per department
- + Much more
We can configure the task sequence to prompt us to enter details like in the screenshot below.
The person running the task sequence will then have to enter values for all the prompts such as below
When next is clicked the following custom variables are then entered in to the task sequence
- Department = IT
- OSDComputerName = Laptop001
- OSVersion = Pro
- Region = UK
Now we have custom variables we can set them against task sequence steps which I will show you below.
When you boot a client in to a task sequence the first window to show will be the welcome screen, If you want to supress this window from showing you can follow the steps in this article I wrote about how to remove the welcome screen from task sequence.
How To Create Custom Variables
To create a custom variable follow these steps
- Open the SCCM Console
- Go to \Assets and Compliance\Overview\Device Collections\
- Right click on “All Unknown Computers” select properties
- Click the Collection Variables tab
- Click the sun icon to add a variable
- Give the variable a name
- Click ok
Now when your task sequence is run it will prompt for these variables
How To Use Variables To Apply Regional Settings
In the previous step we created a variable called Region, using this variable we can configure different regional settings depending what was set.
Below I am going to set UK regional settings.
- Open the SCCM Console
- Go to \Software Library\Overview\Operating Systems\Task Sequences
- Right click on the task sequence you want to change and click edit
- Highlight the “Apply Windows Settings” step and copy and paste to duplicate the amount of regional settings you want to configure. Below I am going to have 2 regions UK + US
- Rename each step adding in the region, below I renamed to “Apply Windows Settings : UK”
- Set the regional settings bottom right
- Click the options tab
- Click Add condition > If statement
- Select all conditions
- Click ok
- Click Add condition >Task Sequence Variable
- Variable = Region
- Value = UK
- Now repeat steps 7-13 for the task sequence step “Apply Windows Settings : US”
How To Use Variables To Put Computer In To Specific AD OUs
If you have multiple OUs you add your active directory computers to, it is a good idea to configure which OU they go into via the task sequence.
To do this follow these steps
- Open the task sequence in edit mode
- Duplicate the “Apply Network Settings” step and renaming it to something like “Apply Network Settings : UK”
- Configure the join a domain options
- Click the options tab
- Click Add condition > If statement
- Select all conditions
- Click ok
- Click Add condition >Task Sequence Variable
- Variable = Region
- Value = UK
- Repeat the steps for all the other “Apply Network Settings : *” steps
How To Use Variables To Install Certain Applications
Above we created the department task sequence variable, we can now use this variable to install only certain applications.
To see how to do this take a look at this article I wrote about that.
How To Use Variables To Install Hardware Drivers
It is very important to install the correct hardware drivers to the correct hardware.
To do this the first thing we need to do is find out the vendor name and model of the hardware we want to add to the task sequence. To find out the vendor and model information take a look at this article I wrote on how to do that.
Then we need to edit the task sequence step to only run for that hardware model, to do that follow the steps I wrote about that here.