For this post, I’ve built a little scenario to explain how to use SCCM Collection variables in Task Sequence.
I get often asked how to reduce the number of SCCM task sequences and how to make them dynamic. I’m always surprised when I hear from an SCCM administrator that they don’t use variables in their task sequence.
Let’s say you are working in an international company and use SCCM to deploy operating systems. Each office has its own configuration and specific software to install. You decide to create 1 task sequence per office. Wrong! You’ll end up in a management nightmare. One task sequence is often enough and this is where you need variables to the rescue.
The magic that you need to understand is collection variables. You have 2 choices, let the user enter the variable value at the beginning of the deployment (explain later) or pre-load these values using collection variables. I prefer the second option which speeds up the deployment process.
Scenario :
- You manage SCCM for 3 offices (Alabama,Boston and Charlotte)
- Each Office have a different Administrator password, different timezone, place their computer in different OU in Active Directory
- Alabama Office needs Office 2010, Adobe Flash 15 and 7zip
- Boston Office needs Office 2013 and Adobe Flash 11
- Charlotte Office needs Adobe Acrobat Reader XI
Here is how to achieve this :
SCCM Collection variables Task Sequence Step-by-Step Guide
#1 – Create your OSD Collections
Create 1 collection per office. For this post, I created 3 collections Offices in Alabama, Boston, and Charlotte. Each Office will receive different configurations and software based on their variables.
#2 – Create your Office variable
- Right click the Alabama collection
- Select Properties
- Select the Collection Variables tab
- Click the star icon
- Create a new variable named Office
- Give it a value of Alabama
- Repeat steps for Boston and Charlotte collection
You’ll end up with 3 collections with their variables having different values.
#3 – Open your task sequence and create condition based on those variable
*I assume that you already have a functional task sequence.
- Open Software Library \ Operating Systems \ Task Sequences
- Right Click your task sequence
- Select Edit
- To place the computer account in a specific OU :
- Browse to the Apply Network Settings Section
- Create 3 Apply Network Settings steps, 1 for each site
- Click Add, Setting, Apply Network Settings
- On each Office configure the Name and Domain OU to fits your needs
- On the Options Tab
- Click Add Condition
- Select Task Sequence Variable
- Enter the variable name Office
- Condition : Equal
- Value : Alabama
***Repeat above steps for Boston and Charlotte changing the value of the variable***
- Browse to the Apply Windows Settings Section
- Create 3 Apply Windows Settings steps, 1 for each site
- Click Add, Setting, Apply Windows Settings
- On each Office configure the TimeZone and Administrator password
- On the Option Tab
- Click Add Condition
- Select Task Sequence Variable
- Enter the variable name Office
- Condition : Equal
- Value : Alabama
***Repeat above steps for Boston and Charlotte changing the value of the variable***
- Browse after the Setup Windows and Config step
- Click Add, General, Install Application
- Create 3 Install Application steps, 1 for each site
- On each step configure the desired software
- On the Option Tab
- Click Add Condition
- Select Task Sequence Variable
- Enter the variable name Office
- Condition : Equal
- Value : Alabama
***Repeat above steps for Boston and Charlotte changing the value of the variable***
Summary
So what we basically did in the previous steps is told the task sequence to run our step based on the Office variable value.
Next, you need to deploy your task sequence to the 3 collections. Ask your IT guys in Alabama, Boston, and Charlotte to use their respective collections.
When the task sequence runs, it will evaluate each step and run only the Alabama step when in the Alabama collection, the Boston step when in the Boston collection, and the Charlotte step when in the Charlotte collection.
Verification
- Start a task sequence
- Open Monitoring\Overview\System Status\Status Message Queries
- Select All Status Messages from a Specific System
- Enter your machine name and select 1 hour ago
- Follow the installation process
- Then the task sequence evaluate a variable you’ll see this message
- You will see when your variable gets skipped meaning that it works
SCCM Collection variables Task Sequence – Extra
If you prefer to have only 1 collection for OSD and ask you IT people to fill in the Office variable, you can achieve that easily.
- Do the same procedure but create only 1 collection for OSD
- Create the Office variable on this collection but leave the value empty
- Doing so, the task sequence will start and wait for a value to be entered in the Office variable
- Double-click the value and enter Alabama, Boston or Charlotte and the task sequence will deploy options based on the designated office
From there, only imagination is the limit. You now understand the power of the variable in a task sequence. Use it in order to maintain the lowest amount of task sequence in your organization.
Read more about variables on Technet.
You can create you collection variable using PowerShell but for now, the cmdlet is broken in CU3. If you need to script the variable creation you must use WMI function for now.
klonk
10.05.2021 AT 02:57 PMklonk
10.06.2021 AT 05:00 PMmih
04.22.2020 AT 07:14 AMAJP
08.02.2019 AT 10:26 AMmichel leard
07.17.2019 AT 09:57 AMRyan Cowell
05.31.2019 AT 06:52 AMAnkush Chawla
07.23.2019 AT 08:52 PMRM
05.08.2019 AT 03:44 PMVijay
01.16.2019 AT 11:35 PMStephan
07.19.2018 AT 07:53 AMNemanja Jovic
03.15.2018 AT 03:32 AMTom
02.06.2018 AT 11:19 AMMatt
12.01.2016 AT 07:35 PMTwenty94470
10.05.2016 AT 03:49 AMBenoit Lecours
10.05.2016 AT 07:48 AMTwenty94470
10.06.2016 AT 03:30 AMBenoit Lecours
10.06.2016 AT 06:31 AMN. Boros
08.12.2015 AT 02:12 PMAaron Whittaker
09.02.2015 AT 06:00 PMHasta
04.22.2015 AT 09:31 AMAnkush
09.04.2017 AT 11:18 PMMatt Sample
10.04.2017 AT 06:30 PMsanj
02.06.2015 AT 07:13 AMBenoit Lecours
02.06.2015 AT 08:30 AMAaron Whittaker
09.02.2015 AT 05:56 PMturbomcp
01.21.2015 AT 05:18 PMUsha
12.13.2014 AT 05:35 PM