Finding Microsoft Home Folder Errors for Citrix XenApp 6.5 Using Microsoft PowerShell
Recently on a project for my new employer, Choice Solutions, I noticed lots of home folder errors in the customer’s System event log. I offered to take my Folder Redirection Error script and modify it to find home folder errors.
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 Home Folder issues.
The error received was:
The Terminal Services User Home Directory was not set because the path specified does not exist or not accessible. The default Home Directory Path was used instead. User Name: UserName Domain: DomainName
I based the new script on the previous Folder Redirection script. The new script follows the same guidelines:
- Run remotely
- Let me specify a start date
- Specify an end date
- Default to 30 days of events to search
- Look only for Home Folder 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 per domain
- Output a file of the user names
- Output a file of the servers that were offline or unable to be accessed
What I found out is that the Source used for the error has nothing to do with what you see in the event log entries or in consoles event log data. The event log entries show the source as “TerminalServices-RemoteConnectionManager” and the event log data shows the source as “Microsoft-Windows-TerminalServices-RemoteConnectionManager” but the actual source that Get-EventLog uses is “TermService”. The other thing we discovered is that not all home folder errors reported are actual errors. If the Domain shown in the event’s description is a trusted domain, even if the home folder existed and the user had all the correct permissions, an error was recorded in the event log. I don’t know if this is the SID name and security filtering resolution taking too long or what.
Another odd thing about this event is that even though there is a user name and domain name recorded in the event’s description, the username property is always “N/A”. The user name and domain name are in another property called ReplacementStrings which is not a string but an array. To properly sort by user name and domain name to get only the unique entries, I created a custom PSObject, stored the user and domain names there, then saved those to an array and then sort by the domain name and username unique. If I tried to sort the array from the property ReplacementStrings, the domain name was always blanked.
Home Folder errors are recorded in the System event log. If you have hundreds of thousands of events in that event log, it can take several minutes to process that log.
This script is in the Miscellaneous section of the downloads page.
You can always find the most current script by going to https://carlwebster.com/where-to-get-copies-of-the-documentation-scripts/