List All Packages From a Task Sequence

Here is a short PowerShell script to list all packages that a ConfigMgr Task Sequence is using, and export to a text file.

# Global Settings
$SiteCode = "PS1" 
$ProviderMachineName = "" 
$TaskSequenceName = "Windows 10 Enterprise x64 21H2 MDM BranchCache XL"

 # Import the ConfigurationManager.psd1 module 
if((Get-Module ConfigurationManager) -eq $null) {
    Import-Module "$($ENV:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1"

# Connect to the site's drive if it is not already present
if((Get-PSDrive -Name $SiteCode -PSProvider CMSite -ErrorAction SilentlyContinue) -eq $null) {
    New-PSDrive -Name $SiteCode -PSProvider CMSite -Root $ProviderMachineName 

# Set the current location to be the site code.
Set-Location "$($SiteCode):\" 

# Disable -Fast check warnings
$CMPSSuppressFastNotUsedCheck = $true

# Get Task Sequence (Do not use -Fast switch, won't return packages if you do)
$TaskSequence = Get-CMTaskSequence -Name $TaskSequenceName

# Get all unique reference packages
$TaskSequencePackages = $TaskSequence.References | select Package -Unique

# Export to a text file without header information
$TaskSequencePackages | ConvertTo-Csv -NoTypeInformation | Select-Object -Skip 1 | Out-File "E:\Setup\TaskSequencePackages.txt"
About the author

Johan Arwidmark

5 1 vote
Article Rating
Notify of
Oldest Most Voted
Inline Feedbacks
View all comments
1 year ago

A big improvement they made with the MECM console is that most nodes allow you to copy paste straight from the console, so if you are in the console looking at the reference tab you can select all the info and hit CTRL+C and you can paste that to a notepad. Almost every node works that way now.