How To Deploy Operating Systems by SCCM Task Sequence

Jason Barrett Jason Barrett | | Task Sequence

In this article I will show you how to create a task sequence in SCCM which can be used to deploy any operating system version you wish.

I have been creating task sequences in sccm for just over 10 years and I will teach you all the best practices that I have learned.

Below is what you will learn in this article.

  • How To Create A Task Sequence
  • How To Edit Task Sequence Steps
  • Configure Support For Multiple Regions
  • Add Drivers For Hardware Models
  • Add Applications
  • How To Get Applications To Only Install On Laptops/Desktops

Lets get started.

It is recommended to install Windows ADK on your SCCM server as this install includes lots of tools we will use in this guide. Check out this article I wrote on how to install windows ADK

1 : Add Operating System Image To SCCM Console

The first thing we need to do is add the install.wim file for the operating system we want to install in to the SCCM console.

To do this follow these steps.

  1. Download the iso file for the operating system you want to install, This can be downloaded from

    Volume Licensing Service Center : You need to sign in with a work or school email account that has permissions. or
    MSDN : Will need an active MSDN subscription for the operating system you want to download
  2. Copy the .iso file on to your SCCM server. Right click on it and select mount. The .iso file will now be mounted on the next available drive on your system.
  3. Go in to the Sources folder and you should see a install.wim file. The wim file should be a few gb in size as shown below.
    sources wim file
  4. Create a folder on your sccm server where we will copy the wim file to.  Below I have created D:\SCCM Packages\Operating_System_Images
    windows 2016 wim file
  5. Copy the wim file to this folder, make sure to give it a good name (Such as Windows2016.wim Windows10_1904.wim and not install.wim, install2.wim, installnew.wim) so it can be easily identified in the future when you might have more wim files in here. 
    TOP TIP : I recommend that you copy all .wim files you import in to SCCM here and do not remove them from this folder.

    If you need to troubleshoot task sequence errors in the future you might want a copy of the original wim file, a prime example is that wim files can become corupted when they are copied to SCCM DP servers.
  6. Open the Configmgr Console
  7. Go to \Software Library\Overview\Operating Systems\Operating System Images  
    add operating system image within configmgr console
  8. Right click on “Add Operating System Image”
  9. Click browse and select the wim file we copied in step 4
  10. Important : Make sure you tick the box “Extract a specific image index from the specified WIM file” This will drastically reduce the size of the wim file which will speed up your operating system deployment 
  11. Next to Image Index: Select the operating system version you plan to install
  12. Architecture select x64
  13. Select relevant language
    add operating system image wizard
  14. Click Next
  15. Enter a good descriptive name, version and comment.  If you have lots of task sequences this will really help.
    operating system image wizard name and version
  16. Click Next
  17. Confirm all your details and click next
    confirm operating system image settings
  18. Click close
  19. Optional Step : If you right click on the operating system image you just added you can click on “Schedule Updates” this can be used to inject the latest software updates in to the wim.
    TOP TIP : In my personal experience I recommend not to schedule updates in to the wim as it can cause issues with task sequence steps failing.

    The wim file can also grow to a huge size and will slow down the staging process. I recommend to install updates at the end of the task sequence.
    schedule updates in wim
  20. We need to distribute the operating system image to all SCCM DP’s
  21. Right click on the operating system image and select distribute content
  22. Click Next
  23. Click Add > Select DP’s
  24. Click Next
  25. Click Next
  26. Click Close
  27. Confirm the operating system image was distributed successfully by clicking on the “Content Status” link
    operating system image content status

2 : Create The SCCM Task Sequence

In this section I will show you how to create a new SCCM task sequence and the additional steps you need to configure such as;

  • Bios Settings
  • Installing Applications
  • Settings For Laptops / Desktops
  • Installing Software Updates
  • Enable Bitlocker

In many SCCM environments I have taken over I have seen multiple task sequences created, usually one for desktop machines and one for laptops. I do not recommend to do this, If you use SCCM variables correctly (IsLaptop for example) it is possible to only use one task sequence which will make your life much easier.

To create a task sequence follow these steps.

  1. Log on to the SCCM Console
  2. Go to \Software Library\Overview\Operating Systems\Task Sequences
  3. Right click on task sequences and select “Create Task Sequence”
    Create Task Sequence
  4. Make sure “Install an existing image package” is highlighted and click next
    Create Task Sequence wizard
  5. On the next window give the task sequence a good descriptive name
  6. Click browse and select “Boot Image (x64)”
    If you want to inject device drivers in to the boot image check out this article I wrote on how to do that.
  7. I recommend to enable “Run as high performance power plan” By enabeling this step I have seen builds take roughly 10% – 20% less time.
    PRO TIP : If you don’t want to enable performance on laptops then you can leave this setting disabled and add a task sequence step with a variable that does the following

    IsDesktop = True Run cmd.exe /c powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
  8. Click Next
    task sequence name
  9. Click browse and select the operating system image we uploaded earlier
  10. Make sure the expected image index is selected
  11. Untick configure Bitlocker
    PRO TIP : In my experience bitlocker is the #1 cause for many task sequence failures, I recommend to start with it disabled and enable it at the end once you have successfully tested the task sequence.
  12. Enter the product key for the version of windows you are installing
  13. Select how you want to set the local administrator password, randomly or enter a password twice
  14. Click Next
    task sequence operating system options
  15. If the built machine is to be put in to a work group select workgroup and click next
  16. If the machine is to be put in to an active directory domain select “Join a Domain” 
  17. Select Domain and Domain OU by clicking the browse buttons
    task sequence configure network
  18. Under account click set
  19. Enter username
  20. Enter password twice
  21. Click Verify > Test Connection
  22. Click Ok
    set task sequence ad account
  23. Click Next
  24. Leave the defaults for the configuration manager client
  25. Click Next
    task sequence install configuration manager client
  26. If you want to use state migration you will need to install the state migration role on a SCCM DP and configure it for this to work. Enable or disable these steps as required.
    PRO TIP : When I rebuild machines, user data backup is the most important thing, there is nothing worse than telling someone “Sorry Your Data Is Gone”
    If you are rebuilding existing machines I recommend to backup users data multiple ways, with the SCCM state migration tool as well as other methods such as “OneDrive” or even a powershell script that runs and backups the data.
  27. Click Next
    task sequence state migration
  28. Select “Do not install any software updates” I will cover installing software updates later in the article
  29. Click Next
    task sequence software updates
  30. At the install applications page click on the yellow sun icon
  31. Select the applications you wish to install, they can be laptop or desktop select all apps and we will organise them later in to groups if needed
  32. Click Next
    task sequence select applications
  33. Confirm settings
  34. Click Next
  35. Click Close
  36. In the SCCM console go to \Software Library\Overview\Operating Systems\Task Sequences
  37. Right click on the task sequence we just created and click edit
    edit sccm task sequence
  38. You will now see the basic steps that have been created.  There are a few things we will need to check and also add to this task sequence which I will cover in the next section.
    basic sccm task sequence

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.

3 : Edit SCCM Task Sequence Steps

Now we have a basic task sequence setup we need to edit a few things and configure them to our needs.

Below is a list of things we need to check;

Set Computer Name Prompt

Currently when the task sequence runs it does not know what name to give a machine, so it will give a default name of “MINT-*****”

We can make the task sequence prompt you to enter a computername.  To configure this follow these steps;

  1. In the SCCM console go to \Assets and Compliance\Overview\Device Collections
  2. Right click on the device collection “All Unknown Computers” and select properties
    Set Computer Name Prompt
  3. Select the “Collection Variables” tab
  4. Click on the yellow sun icon
    all unknown computers device collection properties
  5. Under name enter OSDComputerName
  6. Tick the box “Do not display this value in the Configuration Manager Console”
  7. Leave the value field blank.  Because the value field is blank the task sequence will prompt you to enter a value when it runs.
    add osdcomputername variable
  8. When you run the task sequence it will prompt you as per below

Set Custom Task Sequence Variables

When you launch the sccm task sequence you can make it prompt you to enter values for variables.  You can then use these values in your task sequences to do certain things.

Some examples of variables you might want to use are

  • Region
  • Department
  • OS Version

Then in the task sequence you can activate steps if the above conditions are met, for example

  • If Region = “UK” Then Apply UK Settings
  • If Department = “IT” Then Install IT Applications
  • If OS Version = “PRO” Then Apply Pro Version Of The Operating System Image

To prompt for custom task sequence Variables follow these steps;

  1. Log in to the SCCM Console
  2. Go to \Assets and Compliance\Overview\Device Collections
  3. Right click on the device collection “All Unknown Computers” and select properties
    Set Computer Name Prompt
  4. Select the “Collection Variables” tab
  5. Click on the yellow sun icon
  6. Under name enter the name of the variable you want to add, Below I have added “Region”
  7. Tick the box “Do not display this value in the Configuration Manager Console”
  8. Click Ok
    sccm task sequence region variable
  9. Repeat steps 5-8 For every variable you want to set
  10. Below you can see I have set 4 custom variables
    sccm task sequence set custom variables
  11. Below is a screenshot of what this will look like when you start a task sequence
    sccm task sequence prompt for custom variables

NOTE : Want to create a custom GUI like the ones below take a look at this article I wrote on how to create them.

TsGui with system rediness

Configure Regional Settings

To configure regional settings use to be a right pain, but not any more as its now an option in the task sequence.

To configure regional options do the following

  1. Log in to the SCCM Console
  2. Go to \Software Library\Overview\Operating Systems\Task Sequences
  3. Right click on your task sequence and click edit
  4. Click on the step “Apply Windows Settings”
  5. Change the regional settings as required
    change regional settings in sccm task sequence

Configure Multiple Regional Settings

If you have multiple regions such as US + UK you can use the custom variable we set in the previous step.  When the task sequence is launched it will prompt you to enter a region, what ever you enter as a region will be used in the task sequence.

Below I will show you how to add two regions to your task sequence, US + UK

  1. Log in to the SCCM Console
  2. Go to \Software Library\Overview\Operating Systems\Task Sequences
  3. Right click on your task sequence and click edit
  4. Right Click on the step “Apply Windows Settings” and click copy
    Configure Multiple Regional Settings In SCCM Task Sequence
  5. Now left click on “Apply Windows Settings” to highlight that line, then right click and select paste
    duplicate steps in sccm task sequence
  6. You will now have two steps named “Apply Windows Settings”
  7. Rename these steps to “Apply Windows Settings : UK” and “Apply Windows Settings : US”
    rename regional sccm task sequence step
  8. Left click on the “Apply Windows Settings : UK” step 
  9. Click the options tab
  10. Click add condition
  11. Click if statement
  12. Select Any Condition
  13. Click Ok
    add if statement to regional settings step
  14. Now left click on “If Any the conditions are true” 
  15. Click Add condition
  16. Click “Task Sequence Variable”
  17. In Variable enter the name of your custom variable, in the example above I have used Region
  18. Then in value enter the value of the variable
  19. Now if the conditions are met “Region = UK” this task sequence step will run
    uk regional settings with if command
  20. Now check that the condition looks correct.  This has caught me out a few times as I entered it in wrong and did not double check it.
  21. Confirm there is a dotted L in the condition as highlighted below
    confirm variable added to step correctly
  22. Click on the properties tab
  23. Set the required regional settings 
  24. Click apply to save the changes
    confirm step changes
  25. Left click on the “Apply Windows Settings : US” step 
  26. Repeat steps 9-24 for the US region, make sure to set US as the variable

4 : Add Drivers To SCCM Task Sequence

For each machine that you want to build via the task sequence you need to add the drivers for that system to the task sequence, or the machine will fail to build.

Drivers are another common reason for task sequence failures so it is important to do this step correctly.

Before you can start this section you need to import the drivers in to SCCM, to do this take a look at this article I wrote on how to do that : How To Import Drivers In To SCCM

You will also need to know the vendor and model information for the hardware you want to put in to the task sequence, To get this information you can follow this article I wrote on How To Query WMI To Get Computer Model

To add drivers to your task sequence do the following

  1. Open the SCCM console
  2. go to \Software Library\Overview\Operating Systems\Task Sequences
  3. Open the task sequence with edit
  4. Left Click on the last step under the “Install Operating System” group
  5. Click Add > New Group
  6. add task sequence drivers folderRename the step to “Apply Drivers” or something similar
    apply drivers step
  7. Highlight the “Apply Drivers” folder and click the move down button
  8. Confirm the “Apply Drivers” folder is now not part of the “Install Operating System” group
    move apply drivers step
  9. Now right click on the “Apply Device Drivers” step and select delete
    delete apply device drivers step
  10. Left click on the Apply Drivers folder
  11. Then click Add > Drivers > Apply Driver Package
  12. Give the task sequence step a name, I recommend to use the same naming convention we used before
  13. Click Browse 
    add apply driver step to task sequence
  14. Left click on the driver package you want to add and click ok
    select driver package
  15. Confirm the driver package was selected
    confirm driver package selection
  16. Click the options tab
  17. Click Add Condition > If statement
    add task sequence if statement
  18. Select all conditions
  19. Click ok
  20. Left click “if All The conditions are true” make sure the line is blue
  21. Click Add condition > Query WMI
    select if statement in task sequences
  22. Now add the WMI query to identify the hardware we are adding the drivers for
  23. If you need help to create the query take a look at the article I wrote “How To Query WMI To Get Computer Model” on how to do that
    task sequence step wmi query
  24. Click Test Query
  25. Confirm you see “Contains valid syntax”
    wmi query conatins valid syntax
  26. Click ok
  27. Confirm the query looks correct, check, check and check again, The amount of times I have entered the query wrong with out double checking is quite high 🙁
  28. Also confirm you can see a dotted grey L, this means the query is structured correctly, this has also caught me out to many times
    confirm wmi query in if statement is correct
  29. Click Apply to save the changes we just made
  30. Make sure the step we just added has a green tick, If the step is red that means there is an issue somewhere which will be highlighted with a red !
    adding driver pack to sccm task sequence step complete
  31. This step is now complete

To Summarise

This SCCM task sequence step will now only run if the computer model we set under the options tab is a match and it will apply the drivers that we selected in the properties tab.

PRO TIP : After adding in a new driver package to your task sequence I recommend to test all hardware models that your SCCM environment supports.

This is because sometimes the WMI Query that you just added for this model might run for another model causing the task sequence to fail for that model.

5 : Adding Applications To The Task Sequence

In this section I will show you how to add applications to the task sequence.

I will also show you how to configure the task sequence to only install applications on laptops or desktops or even by department.

Adding An Application

To add applications to your task sequence follow these steps

  1. Open the SCCM console
  2. go to \Software Library\Overview\Operating Systems\Task Sequences
  3. Open the task sequence with edit
  4. Left click to select the last step in the task sequence
  5. Then click add > New Group
    Create applications group in task sequence
  6. Give the group a name, In this example I gave it “General Applications”
  7. In this group I will put all the applications that will install on all machines
  8. Notice that the “General Applications” group is sitting in the “Setup Operating System Group” we need to move out of this group
    create general applications group
  9. Highlight “General Applications” and push the down button
    click down group icon
  10. The group should now be structures like below with the dotted L
    Confirm applications group has moved
  11. To add an application Click Add > Software > Install Application
    add application to task sequence
  12. Click the sun icon
    click sun icon to add application
  13. Find the application you wish to add and tick the box next to it
  14. Click Ok
    select application to add
  15. Enter a name for the application in the name field
  16. Confirm the application appears under “Install the following application” section
    name application
  17. Click apply bottom right to save the task sequence
    TOP TIP : You can add more than one application in to a task sequence step but I recommend to only add one per step.  In my experience it is easier to find the application in the future if you need to, you have more control over it (Can supress errors, Assign a filer like only install on laptops) and makes troubleshooting task sequence failures a bit easier.
  18. Some applications such as Microsoft .net need a reboot to finish the application install, You can add a restart step by doing the following
  19. Click Add > General > Restart Computer (Shown Below)
  20. Below I have added two more applications to complete the General Applications installs
    add restart step in to sccm task sequence

Now any application that is put in to the General Applications group will install for all devices because we did not put any conditions on the applications for application group.

Install Applications On Laptops Only

By Adding a wmi query on to a application group it is possible to only install applications on laptops. To do this follow these steps

  1. Open the task sequence in edit mode
  2. Add a new group by clicking Add > New Group
    Create new group for laptop applications
  3. Name the group something like “Laptop Applications”
  4. Move the “Laptop Applications” group down by pressing the down button
    move laptop applications in to own lines
  5. Click the options tab
  6. Click Add condition > If statement > Any condition
  7. Left click to highlight “If Any the conditions are true”
  8. In the query window enter    Select * from Win32_Battery where chemistry > “0”
  9. Click test query, Confirm you see “Contains valid syntax”
    test laptop wmi query
  10. Click Ok
  11. Click Ok
  12. Now add the applications you want only to install on laptops under this group
  13. Click apply to save the changes you made
    add laptop applications to task sequence

Now any applications placed in the “Laptop Applications” group will only be installed on laptops because they inherit the wmi query we placed on the “Laptop Applications”

Install Applications On Desktops Only

To Install applications on desktop machines only repeat the steps I went over in the laptop section but name the application group “Desktop Applications” and use the query Select * from Win32_Battery where chemistry < “0”  note the > is now a <

Install Applications By Department / Custom Variable

Using custom variables it is possible to install applications only in certain conditions such as by department, Hardware type, Poweruser? 

To be able to do this you need to first set a custom variable, you can see how to do that in this article I wrote How To Use Variables In A SCCM Task Sequence  

Then on the task sequence step put a filter in for the application you want to install, To do this follow these steps

  1. Open the task sequence in edit mode
  2. Select the application you want to filter by
  3. Click the options tab
  4. Click Add condition > If statement > Any condition
  5. Left click to highlight “If Any the conditions are true”
  6. Click add condition > Task Sequence Variable
    select application to filter
  7. Enter the name of the variable
  8. Edit the condition if needed
  9. Enter the value
    enter application filter information
  10. Click ok
  11. Confirm the condition looks correct
    confirm application filter information
  12. Click apply to save the step we just edited

Above we edited the “Active Directory Users and Computers” step to only install for installs where the department equals IT.

How To Add Software Updates

The last step we are going to configure is installing the latest software updates.  It is best practice to install software updates at the end of the task sequence.

To add software updates to your task sequence follow these steps

  1. In the task sequence create a “Software Updates” group and move it to the bottom of the task sequence
  2. Select the Software Updates group
  3. Click Add > Software > Install Software Updates
    install software updates
  4. Make sure required for installation is selected
    confirm software updates
  5. Click apply to save the task sequence

Once the above has been setup the software updates that have been deployed to “All Unknown Computers” will get installed when the task sequence is run.

Useful Articles

Listed below are all the related articles to task sequences that you might find helpful

Troubleshooting Task Sequence Failures

Below is a list of articles I have written on how to fix the common task sequence failures I see in my environments.

  • Error 0x80070490 : This is related to an issue with the task sequence finding a local storage device
  • Error 0x80004005 : This is a general error but the most common error you are likely to see

Leave a Comment