Virtual Desktops Cannot Be Logged Off By Citrix Policy

Environment

  • 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:

Log off screen when trying to log off with unsaved data

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:

HKEY_CURRENT_USER\Control Panel\Desktop

“AutoEndTasks”=”1”

“HungAppTimeout”=”5000”

“WaitToKillAppTimeout”=”20000”

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.

 

UPDATE

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.

Advertisements

2 thoughts on “Virtual Desktops Cannot Be Logged Off By Citrix Policy

  1. Chris says:

    Hey,

    This post got me out of a really deep hole!

    I am working on an implementation of VMware View hosting non-persistent, Windows XP desktops. To enhance the user experience I have used AppSense EM (8.3).

    Much like your issue, View offers a “disconnect time-out” wherein the desktop should be refreshed. After this time-out the desktops became inaccessible, the user unable to log on without manual administrative intervention.

    The AppSense HKLM key allows me to set the HKCU keys in EM policy (which previously did not have the desired effect).

    You may wish to additionally tag the post as it is not limited to the configuration you describe.
    Thanks for sharing your experiences!

    • Hi Chris,

      I’m glad my mad ramblings from the field have helped you out! Glad to be of assistance. It’s very good to know that this works across the VDI board and is more an AppSense issue than VDI specifically. I’ll add some extra tags as you’ve suggested in the hope that it will help others in the future.

      Thanks for taking the time to leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s