Public/Get-UWFAllVolumeExclusion.ps1

Function Get-UWFAllVolumeExclusion {
    <#
    .SYNOPSIS
        Gets a list of all file exclusions for a Unified Write Filter (UWF) protected volume.
    .DESCRIPTION
        Gets a list of all file exclusions for a Unified Write Filter (UWF) protected volume.
 
        If GetExclusions does not find any files or folders in the file exclusion list for the volume, GetExclusions sets the ExcludedFiles parameter to null.
    .INPUTS
        None
    .OUTPUTS
        Returns an HRESULT value that indicates WMI status or a WMI error constant.
    .EXAMPLE
        Get-UWFAllVolumeExclusion
    .LINK
        about_functions_advanced
    .LINK
        about_CommonParameters
    #>

    [CmdletBinding()]
    Param()

    Begin {
    }

    Process {
        If (!$Script:UWFVolume) {
            $ExitCode = 424
            Throw "Unable to get handle to an instance of the UWF_Volume class"
        }
        $GetExclusions = $Script:UWFVolume.GetExclusions()
        $ExitCode = $GetExclusions.ReturnValue
    }

    End {
        If ($Null -eq $ExitCode) {
            # 424 Failed Dependency
            $ExitCode = 424
        }
        If ($ExitCode -eq 0) {
            Write-Output $GetExclusions
        } Else {
            Return $("{0:x0}" -f $ExitCode)
        }
    }
}