Context : Temporary profile error on logon
For multiple and often unknown reasons, users are connected to their session on a temporary profile.
The user does not find his settings including the Outlook profile.
All that is stored in the folder C:\Users\TEMP is not saved when they log off.
If you apply a folder redirection GPO (desktop / documents …), the files and folders modified in it will be saved instead.
Solution to resolve temporary profile issue
The solution is to delete .BAK registry keys in the following location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
On a farm RDS 2012R2, I had the problem regularly with 3 users and so I looked for a way to do this cleaning automatically by script using a scheduled task.
Copy the above script to a file with a vbs extension and do a scheduled task that runs every night on each RD Session Host.
The script generates a log file with the deleted registry keys.
Temporary profile errors were due to the Windows XP RDP client that does not support auto-balancing with the Broker service.