You may have found yourself in a situation where you have had to rebuild a user’s profile to fix an issue or clean up old users’ local cached profiles from Citrix servers after they have left the organization. This wont pose a huge problem if your Citrix farm is small. But if you have a large enough farm, going through this process of properly cleaning a user profile would be a very time consuming process.
The following steps are involved in properly cleaning up a user’s profile:
- Delete the registry key HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\<SID OF THE USER> on all servers.
- Take ownership of the user’s local profile folder on all Citrix servers (Eg: C:\Users\JohnDoe)
- Delete the local user profile folder on all Citrix servers.
- Take ownership of the user’s redirected folder (Eg: E:\USER_FOLDERS)
- Backup the user’s redirected folder.
- Take ownership of the user’s terminal server profile (Eg: E:\USER_PROFILES)
- Backup the user’s terminal server profile.
I’ve hated having to do this manually and so has my team, so I wrote this script that does all the steps mentioned above.
You can download the script here.
How to use the script:
- The script has to run on the server that hosts the user’s redirected folders and profile folders. You can experiment with this, but other configurations have not been tested as of writing this post.
- Place the script in a directory, edit it and modify the variables between the lines ********** Required Configuration BEGIN ********* and ********** Required Configuration END *********. There are examples provided within the script to help you configure the script.
- Run the script against a test user and ensure that the results are as expected.
Drop me a line if this post has helped you or if you have any questions about this script.