Public/Get-UWFVolumeExclusion.ps1
Function Get-UWFVolumeExclusion { <# .SYNOPSIS Checks if a specific file or folder is in the exclusion list for a volume protected by Unified Write Filter (UWF). .DESCRIPTION Checks if a specific file or folder is in the exclusion list for a volume protected by Unified Write Filter (UWF). FindExclusion sets bFound to true only for file and folder exclusions that have been explicitly added to the exclusion list. Files and subfolders that are in an excluded folder are not identified as excluded by FindExclusion, unless they have been explicitly excluded. .PARAMETER FileName A string that contains the full path of the file or folder relative to the volume. .INPUTS System.String .OUTPUTS Returns an HRESULT value that indicates WMI status or a WMI error constant. .EXAMPLE Get-UWFVolumeExclusion -FileName "c:\operator\excludedfile.txt" .LINK about_functions_advanced .LINK about_CommonParameters #> [CmdletBinding()] Param( [Parameter( Mandatory = $true, HelpMessage = "A string that contains the full path of the file or folder relative to the volume." )] [string]$FileName ) Begin { } Process { If (!$Script:UWFVolume) { $ExitCode = 424 Throw "Unable to get handle to an instance of the UWF_Volume class" } $FindExclusion = $Script:UWFVolume.FindExclusion($FileName) $ExitCode = $FindExclusion.ReturnValue } End { If ($Null -eq $ExitCode) { # 424 Failed Dependency $ExitCode = 424 } If ($ExitCode -eq 0) { Write-Warning "Committing $FileName deletion" } Return $("{0:x0}" -f $ExitCode) } } |