Today I got an interesting question – Is it possible to gather the sizes for all packages referred by a OS deployment task sequence? I have a script that will find all package sizes for any group of packages you select, but not specifically for a task sequence.
But I found it can be done quite easily. Simply enter your task sequence name and your site code, and the script will return all the packages referenced in that task sequence with their package sizes, and also give the total count and total size.
$TaskSequenceName = "Windows OS Deployment x64" $SiteCode = "ABC" $TSID = Get-WmiObject -Namespace ROOT\sms\Site_$SiteCode -Query "Select PackageID from SMS_PackageStatusDetailSummarizer where Name = '$TaskSequenceName'" | Select -ExpandProperty PackageID $PKGs = Get-WmiObject -Namespace ROOT\sms\Site_$SiteCode -Query "Select * from SMS_TaskSequencePackageReference where PackageID = '$TSID'" | Select @{N='PackageName';E={$_.ObjectName}},@{N='Size (MB)';E={$($_.SourceSize / 1KB).ToString(".00")}} | Sort PackageName $Stats = $PKGs | Measure-Object "Size (MB)" -sum $PKGs | Out-GridView -Title "Packages in ""$TaskSequenceName"" | Total Packages: $($Stats.Count) | Total Size of Packages: $(($Stats.Sum / 1KB).ToString(".00")) GB"