Ever needed to list all applications in a Tasksequence via powershell?

Function TaskSequenceReferences(){

$AllTS = Get-CMTaskSequence | select Name, sequence

Foreach($TSName in $AllTS.name){
$TS = Get-CMTaskSequence -Name “$TSName” | select Sequence

$TSxml = ConvertTo-Xml $TS#.Sequence
[xml]$XML = $TSxml.OuterXml.Replace(‘&gt;’,’>’).Replace(‘&lt;’,'<‘)

#Application info
$AppList = ($XML.SelectNodes(“//defaultVarList/variable”) | Where-Object {$_.property -like “AppInfo*DisplayName”}).’#text’

Foreach($Appl in $AppList){
Write-Host $Tsname”,”$Appl
}
}

}

 

Advertisements