TS/RDS Profile Cleaner Utilities
- Published: Tuesday, 26 October 2010
Still one of the big challenges in Serves Based Computing environment (and when many users are using the same workstation in a VDI - or a traditional fat client environment) is still the user profile. One of the issues with user profiles is that the profile does not unload correctly and the profile stays on the server/workstations forever. If the root cause cannot be found or solved you will end up with hundreds of user profiles on the local disk, which takes a lot of disk space and makes troubleshooting more difficult.
On Windows XP or a Windows 2003 Terminal Server you could simply delete the profile directories (after a reboot of the system, to be guaranteed that no files are in use) and when the user logs on again everything run fine again.
However this is not a real clean method, because the registry referral still exists to profile directory. When Windows XP and Windows 2003 Terminal Server finds out the registry key is still there and the user profile directory on the disk does not exist it just create the key again. Windows Vista, Windows 7 and Windows 2008 (R2) have a different behavior. When the key is still found, the key is renamed and a new key is made. The user will logon with a temporary profile (so settings are not retained) and at log off the renamed key is place back in the original state.
With this behavior in the latest version the needs for a utility or script is needed more and more so let's take a look at some of the available tools.
The first utility is developed by Yehuda Cohen and is called TSProfileCleaner. The utility does not have an installation process. It's just a single executable that can be started directly. You need to have .Net Framework 2 or higher available on the system. At this moment the utility is not supported on Windows 2008 and Windows 2008R2 servers, so Windows 2003 is only supported.
The utility is created to troubleshoot profiles. Within the tool you can specify your Terminal Servers available within your environment on the left side. From that server you can make a selection which servers should be checked of the profile is situated there, followed by a deletion of the profile on that server. You specify the profile name (the username) and the domain and optional the central share location (so also this roaming profile will be cleaned). After filling in the information the Delete button arranges that the process really starts.
Another utility available is delprof.exe supplied as freeware utility by Microsoft as part of the Windows 2003 Resource Kit, but can also be downloaded separately. Currently the download mentions that the tool is suitable for Windows XP and Windows 2003, but it also works on Windows Vista and Windows 2008 (did not test in on Windows 7 or Windows 2008R2, but both are using the same profile structure as Vista/Windows2008 so I expect the tool will function on those operating systems as well).
The download on the Microsoft site is a MSI installation file. The MSI actually just unpacks the corresponding files.
With Delprof.exe it is possible to delete all user profiles from the server. The utility can be used to remove the profiles from a remote server. Other useful parameters are /r that only removes only roaming profiles (so local profiles will not be removed), /d to specify the number of days the profile is inactive before it will be deleted and /q so the utility does not ask a confirmation to delete (every) profile.
I tried to use the utility within startup and/or unattended scripts, but in some way the utility does not function in that environment. I'm not sure if the utility is not suitable for scripts or it was a specific problem. Also a downside of the utility that it will delete all profiles and you cannot specify any exclusions.
To solve the issue running cleaning profiles from a startup script and control which profiles will not be deleted a quick search in that time leaded me to Joe Shonk. Joe Shonk created a wonderful script called delprofiles.vbs. With this script you can specify exclusions (including wildcard support), specify a day interval and includes logging to check the results of the script. I only use this script at my customers, because it offers all the possibilities needed and it works fine in startup scripts. Also by default the script skips default profiles like the local administrator and several Citrix accounts.
User Profiles are and will be in the near future a challenge in SBC, VDI and flexible workplaces infrastructures. To manage the removal of unloaded profiles several tools are available, so show the possibilities I showed three of them (I'm sure there will be more utilities available). Personally I always the Use DelProfiles.vbs script, because it offers excellent options and works fine. For troubleshooting issues TSProfileCleaner can be used, it's a pity that is currently only support Windows XP and Windows 2003.