Public/Enable-HPWF.ps1

Function Enable-HPWF {
    <#
        .SYNOPSIS
            Enables HP Write Manager on the next reboot.
        .DESCRIPTION
            Enables 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("Enable HP Write Filter")) {
            $Ret = $HpWF.EnableFilter()
            If ($Ret.ReturnValue -gt 0) {
                Throw "Enabling filter failed with error $Ret.ReturnValue"
            } Else {
                Write-Warning "Enabling filter succeeded! Reboot to complete nabling the filter!"
            }
        }
    }
}
Set-Alias -Name Enable-HPWriteFilter -Value Enable-HPWF -Option ReadOnly -PassThru -ErrorAction SilentlyContinue