CM Task Sequence

You can use PowerShell to create a CM Task Sequence to create a Custom Task Sequence. This is one that I used personally (you will need to adjust this to your environment). If you run into any issues with this script, just create your Task Sequence manually

$CMLibrary = '\\SERVER\SHARE$\OSDDrivers'
$CMSiteCode = 'XXX:'
$CMBin = "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin"

#Get-OSDDrivers
$OSDDrivers = Get-ChildItem "$CMLibrary","$CMLibrary\NvidiaPack 10.0 x64" -Directory | Where {$_.Name -ne 'NvidiaPack 10.0 x64'} | Select Name | Sort Name -Descending

#Import Module
Import-Module "$CMBin\ConfigurationManager.psd1"
CD $CMSiteCode

# Create a new Task Sequence (thanks Johan!)
$TS = New-CMTaskSequence -CustomTaskSequence -Name "OSDDrivers 10.0 x64"

foreach ($OSDDriver in $OSDDrivers) {
    $Name = $OSDDriver.Name
    Write-Host "Name: $Name" -ForegroundColor Green

    $Group = New-CMTaskSequenceGroup -Name $Name
    Add-CMTaskSequenceStep -InsertStepStartIndex 0 -TaskSequenceName $TS.Name -Step $Group
}

This took about a minute to complete in my environment

This is what the new Task Sequence looks like in ConfigMgr. This is a very simple and clean Driver Task Sequence

DellMultiPack Conditions

The purpose for creating Groups is to allow you to add and remove Steps in the Group, without having to set Conditions on each of the individual steps

IntelPack and NvidiaPack Test do not need any Task Sequence Conditions as they should run in all OS Deployments

DellMultiPack Groups

Since my Dell MultiPacks are separated by Generation, to prevent all of them from applying, I'll need to set a WMI Query for Computer Model on each of the DellMultiPack Groups. To easily configure this, look in the corresponding DellMultiPack directory for a text file called WmiQuery.txt. Use the contents of this file to create your WMI Query

If you later add a Model to the Dell MultiPack, remember to review the WmiQuery.txt file to update your Task Sequence Group Condition

IntelPack and NvidiaPack Test

Don't set any Conditions on either of these Groups

by setting a Task Sequence Variable

If you are deploying NvidiaPacks in separate Groups, you

If you are deploying the NvidiaPack Test, then you can use these Conditions in your Task Sequence. The purpose of the NvidiaPack Test is to set Task Sequence Variables. You can see how this works in one of the NvidiaPack Test logs. This particular system matched the HardwareID with 7 different Drivers, but the Task Sequence Variable NvidiaPack was only set to the last (newest) one

NvidiaPack Conditions

If you have run your NvidiaPack Test first, you can set Conditions on the Groups. The purpose of the NvidiaPack Test is find the matching Nvidia Driver Package and set Task Sequence Variables

Write-Verbose "Setting Task Sequence Variable NvidiaPackGrouping to $($NvidiaTask.DriverGrouping)" -Verbose
$TSEnv.Value('NvidiaPackGrouping') = "$($NvidiaTask.DriverGrouping)"

Write-Verbose "Setting Task Sequence Variable NvidiaPack to $($NvidiaTask.DriverReleaseId)" -Verbose
$TSEnv.Value('NvidiaPack') = "$($NvidiaTask.DriverReleaseId)"

For each Group, set a Condition for Task Sequence Variable NvidiaPack with the ReleaseId as the value

Add Packages

Once all the conditions have been added to the Task Sequence Groups, I can add a Run PowerShell Script using the OSDDriver Packages. Make sure the Execution Policy is set to Bypass

When finished, the Task Sequence should look similar to the one below

Last updated