Public/Disable-HPWF.ps1

Function Disable-HPWF {
    <#
        .SYNOPSIS
            Disables HP Write Manager on the next reboot.
        .DESCRIPTION
            Disables HP Write Manager on the next reboot.
        .INPUTS
            None
        .OUTPUTS
            Returns 0 when successful. Otherwise, it returns an error code.
        .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 $HpWF) {
        If ($PSCmdlet.ShouldProcess("Disable HP Write Filter")) {
            $Ret = $HpWF.DisableFilter()
            If ($Ret.ReturnValue -gt 0) {
                Throw "Disabling filter failed with error $Ret.ReturnValue"
            } Else {
                Write-Warning "Disabling filter succeeded! Reboot to complete disabling the filter!"
            }
        }
    }
}
Set-Alias -Name Disable-HPWriteFilter -Value Disable-HPWF -Option ReadOnly -PassThru -ErrorAction SilentlyContinue