Technology Solutions for Everyday Folks
Hello my name is {X} tag

Collection Variables in SCCM Task Sequences

As I've mentioned a number of times in previous posts, on our campus we perform a roughly-annual refresh of multi-user workstations across the institution. This 'multi-user' scope includes machines in classrooms, computer labs, open learning spaces, conference rooms, and so forth.

By performing a refresh (wipe and load), we effectively reset all of these machines back to a known, consistent state across the fleet. It's also primarily how we control for Windows feature updates (the annual or semi-annual "big" updates) without requiring dark magic or causing untimely reboots. Due to the varied nature of the scope in question, even applying an overnight reboot will certainly impact some user (as some spaces are open 24 hours). So we do it the "easy" and "low tech" way.

Enter Automation

While we effectively invoke a task sequence/rebuild manually, the true magic is the automation behind the process, once invoked. I've written about how we auto-generate computer names and determine IP addresses which allow the task sequence to branch off as appropriate for a given space or circumstance.

In a future post, I'll certainly delve into the auto-update process for our Dell firmware (BIOS), which is the thing that makes me most happy...but that's another story.

This post is geared toward how I've used the inspiration from my Windows admins partners by leveraging collection variables in a task sequence operation. I won't regurgitate the content in how it works, but I will say that recognizing I could use collection variables in our task sequences was life-changing a year ago...and it's still life-changing today, though I understand my colleagues have already moved past this method for several of their spaces.

The primary use case for my collection variables in the multi-user task sequence is to customize by location (physical location) and "classification" (lab, public, conference). Collection variables are the primary decision point for many task sequence processes. If for some reason (usually new hardware) the collection variable doesn't exist, it will roll over to determine IP address (secondary option) or a relatively standard WPF form as a tertiary/final option.

A Simple Example

# Task Sequence Variables
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
# Get Collection Variable/Automatic Classification
$Classification = $tsenv.Value("Classification")
# FIRST STEP/TRY/OPTION: DETERMINE INSTALL TYPE BY CLASSIFICATION VARIABLE (IF PRESENT/SET)
if (($Classification -ne $null) -or ($Classification -ne "")) {
    # A value is set; proceed
    switch ($Classification) {
        "Lab" { $IType = "Lab"; Break }
        ... { $IType = "..."; Break }
    }
}

The above is a simple way to use the Classification collection variable to do something (in this case, set the IType task sequence specific variable). This example is not production-ready code.

That's Great, but What's the Impact?

For almost all of the annual refreshes, this means our techs now spend just a few seconds to start the process on a given machine. Three or four years ago, a tech would have to spin off a separate firmware update, double-check the computer name (or "fat-finger" it...), and then use a clunky dialog to choose the correct installation options...which would invariably be selected incorrectly about 20% of the time. These extra manual decision points would take 10-15 minutes per machine.

That time is now better spent. Usually in starting the process on additional machines.

We only have about 400 workstations in this classification, but when you add up the cumulative time savings of the automation, it's pretty dramatic. This year we're on track to complete those rebuilds and refreshes within two weeks, and that's actually as we've hit the upper bound of our local distribution point's capacity (network and disk bottlenecks). I'm convinced we'll undoubtedly do better than this year.

Incremental Changes

The key takeaway is to make something better...whatever small thing that might be. For me it's been firmware updates, IP matching, pre-populated variables, use of WMI queries, collection variables, and auto-naming. Each one of these things was an independent action, but has a huge impact in the collective. Good luck!

Headline image via The Rapid E-Learning Blog