Add Classifications to New-PoshWSUSUpdateScope

Apr 8, 2014 at 3:49 PM
I wanted to do this
$updatescope = New-PoshWSUSUpdateScope -Classifications ("Critical Updates","Security Updates") -ExcludeOptionalUpdates -ExcludedInstallationStates ("NotApplicable","Unknown")
So I added this to New-PoshWSUSUpdateScope:
[parameter()]
[string[]]$Classifications

.
.
.

If ($PSBoundParameters['Classifications']) {
    Write-Verbose "Adding values to Classifications property"
    $UpdateScope.Classifications.Clear()
    $UpdateClassifications=$Wsus.GetUpdateClassifications()
    $ClassificationRange = @()
    foreach ($Classification in $Classifications)
    {
        $ClassificationRange += $UpdateClassifications | ?{$_.Title -eq ($Classification)}

    }
    $UpdateScope.Classifications.AddRange($ClassificationRange)
} 
This produces an update scope that looks like this:
ApprovedStates               : Any
UpdateTypes                  : All
TextIncludes                 :
TextNotIncludes              :
FromArrivalDate              : 1/1/0001 12:00:00 AM
ToArrivalDate                : 12/31/9999 11:59:59 PM
Categories                   : {}
Classifications              : {e6cf1350-c01b-414d-a61f-263d14d133b4, 0fa1201d-4330-4fa8-8ae9-b877473b6441}
IncludedInstallationStates   : All
ExcludedInstallationStates   : Unknown, NotApplicable
IsWsusInfrastructureUpdate   : False
FromCreationDate             : 1/1/0001 12:00:00 AM
ToCreationDate               : 12/31/9999 11:59:59 PM
UpdateApprovalActions        : All
ApprovedComputerTargetGroups : {}
UpdateSources                : All
ExcludeOptionalUpdates       : True
UpdateApprovalScope          :