Public/Unprotect-HPWFVolume.ps1

Function Unprotect-HPWFVolume {
    <#
        .SYNOPSIS
            Removes a volume to the protected list for the next session.
        .DESCRIPTION
            Removes a volume to the protected list for the next session.
        .PARAMETER DriveLetter
            The driveletter to remove from the protected list
        .INPUTS
            System.IO.DriveInfo
        .OUTPUTS
            System.String
        .EXAMPLE
            Unprotect-HPWFVolume -DriveLetter C:
        .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 )]
        [ValidateScript( { Test-IsDriveLetter $_ } )]
        [System.IO.DriveInfo]$DriveLetter
    )
    If ($null -ne $HpWF) {
        If ($PSCmdlet.ShouldProcess($DriveLetter, "Unprotect Volume")) {
            $Ret = $HpWF.UnprotectVolume($DriveLetter)
            If ($Ret.ReturnValue -gt 0) {
                Throw "Unprotecting volume $DriveLetter failed with error $Ret.ReturnValue"
            } Else {
                Write-Output "Unprotecting volume $DriveLetter succeeded!"
            }
        }
    }
}