Public/Remove-UWFAllVolumeExclusions.ps1
Function Remove-UWFAllVolumeExclusions { <# .SYNOPSIS Removes all files and folders from the file exclusion list for a volume protected by Unified Write Filter (UWF). .DESCRIPTION Removes all files and folders from the file exclusion list for a volume protected by Unified Write Filter (UWF). This command does not remove registry exclusions. You must use an administrator account to remove file or folder exclusions, and you must restart the device for this change to take effect. .INPUTS None .OUTPUTS Returns an HRESULT value that indicates WMI status or a WMI error constant. .EXAMPLE Remove-UWFAllVolumeExclusions .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" } $RemoveAllExclusions = $Script:UWFVolume.RemoveAllExclusions() $ExitCode = $RemoveAllExclusions.ReturnValue } End { If ($Null -eq $ExitCode) { # 424 Failed Dependency $ExitCode = 424 } If ($ExitCode -eq 0) { Write-Warning "Removing all file and folder exclusions on the next restart" } Return $("{0:x0}" -f $ExitCode) } } |