Skip to content

Instantly share code, notes, and snippets.

@w0
Created June 8, 2021 17:32
Show Gist options
  • Save w0/42999cd401d6963ef513538a9e3d0e07 to your computer and use it in GitHub Desktop.
Save w0/42999cd401d6963ef513538a9e3d0e07 to your computer and use it in GitHub Desktop.
Find Task Sequences that reference a application
<#
Find all task sequences where a application is referrenced.
$App name should match the admin console name
#>
$App = Get-CMApplication -Name 'AppName'
$TaskSeqIDs = (Invoke-CMWmiQuery -Query "select * from SMS_TaskSequenceAppReferencesInfo where RefAppModelName like '$($App.Modelname)'").PackageID
foreach ($TS in $TaskSeqIDs) {
$TaskName = (Get-CMTaskSequence -Fast -TaskSequencePackageId $TS).Name
Write-host ('App: {0} found in: {1}' -f $App.LocalizedDisplayName, $TaskName)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment