Public/Functions/split/Get-EnablementPackage.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
function Get-EnablementPackage { [CmdletBinding()] param ( [ValidateSet('22H2','21H2','21H1','20H2','1909')] [Alias('Build')] [string]$OSBuild = '22H2', [ValidateSet('x64','x86')] [string]$OSArch = 'x64' ) #================================================= # Import Local EnablementPackage #================================================= $Result = Get-WSUSXML -Catalog Enablement -Silent #================================================= # Filter Compatible #================================================= $Result = $Result | ` Where-Object {$_.UpdateArch -eq $OSArch} | ` Where-Object {$_.UpdateBuild -eq $OSBuild} #================================================= # Pick and Sort #================================================= $Result = $Result | Sort-Object CreationDate -Descending | Select-Object -First 1 #================================================= # Return #================================================= Return $Result #================================================= } |