- Citrix XenDesktop 5.5 with Windows 7 virtual desktops
- Citrix Provisioning Services 6.0
- AppSense Environment Manager 8.2
Recently, at a customer, they were having an issue where Virtual Desktops were not restarting every night as they should be. The correct Citrix policy was in place to reboot the virtual desktops but certain desktops were not restarting.
It was noticed that the desktops that were not restarting had disconnected sessions on them. Now, there was another Citrix policy to log off disconnected sessions after a certain amount of idle time. Again, the policy was correctly applied.
I then noticed that during a disconnected session with unsaved work (say a Word doc although I tested several other applications and got the same result) that if you clicked Log Off, you were displayed with the following:
Now, this screen would stay indefinitely until you manually intervened and clicked Force log off. The interesting thing is that when the Citrix policy would try to log off a disconnected session with unsaved work, the EXACT same screen was presented and would stay indefinitely. This is because when Citrix fires a log off command via Citrix Policy, it uses the logoff.exe command the same as clicking Start > Logoff works.
NB. If you click Force Logoff from within the Desktop Studio or Desktop Director, this uses a different command and WILL force log off.
So, the next piece of the puzzle was to work out what was stopping the session was being logged off gracefully.
The first port of call was checking that the following registry entries were in place:
Now, these registry entries should wait for the set time and then force log off even if an application is open with unsaved work. They didn’t make a difference L
As AppSense Environment Manager was being used, this was the next thing to test. By disabling the User Virtualisation service, we were now able to get graceful log-offs from the Citrix policy (or manually) even if there was unsaved work.
A quick call to AppSense confirmed that I needed to change the following Registry entry:
HKEY_LOCAL_MACHINE\SOFTWARE\AppSense\Environment Manager\RemoveForceLogoffFlag and change from 1 to 0.
AppSense also confirmed that this is a recognised and supported fix.
Once the value was set and baked into the Provisioning Services image, this now allowed Citrix policy (and users manually) to log off an active or disconnected session even if there was unsaved work.
Hopefully, this will help people who are having this issue on XenDesktop using AppSense EM.
It has been noted that the issue seen above is not limited to Citrix XenDesktop but is more to do with how AppSense Environment Manager interacts with the virtual desktop as this scenario has also been seen with VMware View non-persistent desktops – thanks Chris.