Public/Remove-HPRFExclusion.ps1
Function Remove-HPRFExclusion { <# .SYNOPSIS Removes a key from the key exclusion list. .DESCRIPTION removes a key from the key exclusion list. The path must be a path beginning with a well-known key (e.g. HKLM\\System\\CurrentControlSet\\Services, HKU\\.DEFAULT). .PARAMETER ExclusionKey The registrykey to exclude .INPUTS String .EXAMPLE Remove-HPRFExclusion -ExclusionKey HKLM\\System\\CurrentControlSet\\Services\Tcpip .LINK about_functions_advanced .LINK about_CommonParameters .LINK http://h10032.www1.hp.com/ctg/Manual/c06173592 #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Medium" )] Param( [Parameter(Mandatory = $true)] [String]$ExclusionKey ) If ($null -ne $HpRF) { If ($PSCmdlet.ShouldProcess($ExclusionKey, "Remove key from exclusion list")) { $Ret = $HpRF.RemoveExclusion($ExclusionKey) If ($Ret.ReturnValue -eq 0) { Write-Output "Exclusion key"$ExclusionKey "removed successfully." 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 } } Else { If ($Ret.ReturnValue -eq 2147749890) { Write-Output "Exclusion key "$ExclusionKey "not found. Error: " $Ret.ReturnValue } Else { Write-Output "Exclusion key "$ExclusionKey "was NOT removed. Error: " $Ret.ReturnValue } } } } } } |