How To Use Variables In A SCCM Task Sequence

Jason Barrett Jason Barrett | | Task Sequence

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.

enter custom variables task sequence

The person running the task sequence will then have to enter values for all the prompts such as below

custom values filled out

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

  1. Open the SCCM Console
  2. Go to \Assets and Compliance\Overview\Device Collections\
  3. Right click on “All Unknown Computers” select properties
  4. Click the Collection Variables tab
  5. Click the sun icon to add a variable
  6. Give the variable a name
  7. 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.

  1. Open the SCCM Console
  2. Go to \Software Library\Overview\Operating Systems\Task Sequences
  3. Right click on the task sequence you want to change and click edit
  4. 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
  5. Rename each step adding in the region, below I renamed to “Apply Windows Settings : UK”
  6. Set the regional settings bottom right
    change regional settings step
  7. Click the options tab
  8. Click Add condition > If statement
  9. Select all conditions
  10. Click ok
  11. Click Add condition >Task Sequence Variable
  12. Variable = Region
  13. Value = UK
    options tab regional settings
  14. 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

  1. Open the task sequence in edit mode
  2. Duplicate the “Apply Network Settings” step and renaming it to something like “Apply Network Settings : UK”
  3. Configure the join a domain options
    set variables for active directory join
  4. Click the options tab
  5. Click Add condition > If statement
  6. Select all conditions
  7. Click ok
  8. Click Add condition >Task Sequence Variable
  9. Variable = Region
  10. Value = UK
  11. 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.

Leave a Comment