<< Back to Script Library
Find Folder Redirection Errors
This script looks for Folder Redirection errors (Event ID 502) that occurred on the selected managed computer within the last 30 days.
Version: 2.3.8
Created: 2017-05-21
Modified: 2019-03-17
Creator: Carl Webster
Downloads: 1068
Tags: EventLog FileRedirection folder redirection Group Policy
Created: 2017-05-21
Modified: 2019-03-17
Creator: Carl Webster
Downloads: 1068
Tags: EventLog FileRedirection folder redirection Group Policy
The Script
Copy Script
Copied to clipboard
<#
ControlUp-friendly version of Carl Webster's 'Get-FRErrorsV2' script (Get Folder Redirection Errors)
http://carlwebster.com/downloads/download-info/get-gpo-folder-redirection-errors-xenapp-6-5/
#>
[Datetime]$StartDate = ((Get-Date -displayhint date).AddDays(-30))
[Datetime]$EndDate = (Get-Date -displayhint date)
try {
$Errors = Get-EventLog -logname application `
-source "Microsoft-Windows-Folder Redirection" `
-entrytype "Error" `
-after $StartDate `
-before $EndDate `
-EA 0
} catch {
Write-Host "Error querying event log"
Continue
}
If($? -and $Null -ne $Errors) {
If (!($Errors -is [Array])) {
#force the singleton to an array
[array]$Errors = $Errors
}
$Users = $Errors | Select UserName | Sort UserName -Unique
If (!($Users -is [Array])) {
#force the singleton to an array
[array]$Users = $Users
}
$ErrorPaths = @()
Write-Host "$($Errors.Count) Folder Redirection errors found for $($Users.Count) users"
Foreach ($Err in $Errors) {
$m = $null
$ErrorPath = $null
$m = $Err.Message
try {
$ErrorPath = $m.substring($m.indexof("\\"),$m.indexof('".')-$m.indexof("\\"))
} catch {
# Meh
}
if ($ErrorPath -ne $null) {
$ErrorPaths += $ErrorPath
}
}
$ErrorPaths = $ErrorPaths | Sort -Unique
Write-Host "$($ErrorPaths.Count) erroneous paths found:"
$ErrorPaths
}
Else
{
Write-Host "No Folder Redirection errors found"
}