Public/Update-HPRFExclusion.ps1

Function Update-HPRFExclusion {
    <#
        .SYNOPSIS
            Makes all NextActive key exclusions become active.
        .DESCRIPTION
            Makes all NextActive key exclusions become active.
        .INPUTS
            None
        .OUTPUTS
            None
        .LINK
            about_functions_advanced
        .LINK
            about_CommonParameters
        .LINK
            http://h10032.www1.hp.com/ctg/Manual/c06173592
    #>

    [CmdletBinding(
        SupportsShouldProcess = $true,
        ConfirmImpact = "Medium"
    )]
    Param()
    If ($null -ne $HpRF) {
        If ($PSCmdlet.ShouldProcess("Registry exclusion list", "Update")) {
            $Ret = $HpRF.UpdateExclusions()
            If ($Ret.ReturnValue -gt 0) {
                Throw "Pending registry exclusions not updated. Error: $Ret.ReturnValue"
            } Else {
                Write-Output "Pending registry exclusions now active"
                # Be sure properties are set correctly
                Write-Output "Active Key Exclusions"
                ForEach ($Item in $HPRFEE) {
                    If ($Item.Active) {
                        Write-Output "Excluded Key: " $Item.KeyName
                    }
                }
                Write-Output "Key Exclusions in Next Session"
                ForEach ($Item in $HPRFEE) {
                    If ($Item.NextActive) {
                        Write-Output "Excluded Key: " $Item.KeyName
                    }
                }
            }
        }
    }
}