Public/Remove-HPWFExclusion.ps1
Function Remove-HPWFExclusion { <# .SYNOPSIS Removes a file or directory from the file exclusion list on the next session. .DESCRIPTION Removes a file or directory from the file exclusion list on the next session. .PARAMETER Path The path to remove .INPUTS System.IO.FileInfo .OUTPUTS Returns 0 when successful. Otherwise, it returns an error code. .EXAMPLE Remove-HPWFExclusion -Path C:\SomePath .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)] [System.IO.FileInfo]$Path ) If ($null -ne $HpWF) { If ($PSCmdlet.ShouldProcess($Path, "Remove from exclusion list")) { $Ret = $HpWF.RemoveExclusion($Path) If ($Ret.ReturnValue -eq 0) { Write-Output "Exclusion path $Path removed successfully." } Else { If ($Ret.ReturnValue -eq 2147749890) { Throw "Exclusion path $Path not found. Error: $Ret.ReturnValue" } Else { Throw "Exclusion path $Path NOT removed. Error: $Ret.ReturnValue" } } } } } |