Finding Microsoft Folder Redirection Errors for Citrix XenApp 6.5 Using Microsoft PowerShell
Another issue causing slower logons for users at a recent project was Folder Redirection errors. This article is how I found the issue and how the customer resolved them.
[Updated 10-Mar-2016 to handle PowerShell V2 singletons when the first server processed has only one Folder Redirection error.]
This project and article are specifically for Citrix XenApp 6.5 running on Microsoft Windows Server 2008 R2 but can easily be adapted for other Windows versions and Citrix XenApp products.
As is my practice, one of the first things I do when looking into issues is to look in the event logs. For this customer I noticed there were a lot of Folder Redirection issues. Further investigation showed they were redirecting just about everything.
The error received for all nine redirected folders was:
Failed to apply policy and redirect folder “Documents” to “\\fileserver\users\carl.webster\My Documents”.
The following error occurred: “Can not create folder “\\fileserver\users\carl.webster\My Documents””.
Error details: “Access is denied.”.
A successful Folder Redirection event took .10 seconds and a failure took .25 seconds. In other words, the nine redirected folders were taking .90 seconds when it worked and 2.25 seconds when it didn’t work. 2.25 divided by .9 is 2.5 so the failure events were taking 250% as long as the successful events.
I manually investigated about 10 servers but the customer has 368 XenApp 6.5 servers. How do I find all the Folder Redirection failures, find all the user accounts associated with each failure and then give the customer a sorted list of unique user names? PowerShell of course. Who would have guessed?
I need a script that would:
- Run remotely
- Let me specify a start date
- Specify an end date
- Default to 30 days of events to search
- Look only for Folder Redirection errors
- Specify an output folder
- Get a list of all XenApp 6.5 servers in the farm
- Make sure the server was online
- Record if the server is offline or has an error being accessed
- Create a sorted list of unique user accounts
- Output a file of the user names
- Output a file of the servers that were offline or unable to be accessed
Could the script be changed to work with XenApp 7.x? Sure. Could the script be changed to work with an input file of computer names? Sure. So why didn’t I do all that? The customer is paying me to solve their issues, not write scripts. If I ever find the time, I will update the script so it can be used with XenApp 7.x or an input file.
After running the script, I gave the customer a list of almost 700 unique user names that were having issues with Folder Redirection. What that means is that whoever is creating user accounts is not following their documented process and some additional training (i.e. whacking upside the head) is required.
If you want to think about the wasted time for the users:
700 users * 2.25 seconds is 1575 seconds. If the users only logon once and only launch one application, that is 3150 wasted seconds or 52.5 wasted minutes.
The script should be able to work as a scheduled task. The script is designed to be run directly on a ZDC and works with PowerShell V2. On average, the script processes 64 servers per hour using the default of 30 days of events to search.
This script is in the Miscellaneous section of the downloads page.
You can always find the most current script by going to https://www.carlwebster.com/where-to-get-copies-of-the-documentation-scripts/