Windows, and in particular Windows XP, is pretty sensitive when it comes to the log off proccess. When you leave applications running and just choose to log off this can sometime result in a hanging computer. In a traditional environment with physical machines this is not directly a problem because the user always has the ability to just push and hold the power button.
Now in a virtualized environment this suddely becomes a problem because power cycling the endpoint has no effect on the virtual desktop.
And beside that it is (unfortunately) more and more common for users to leave applications running in the background and just disconnect the session instead of logging off and let the disconnect and idle timer do the job.
The Citrix Web Interface contains functionality to let users restart their Virtual Desktop. But this is not a real solution for the more common user, especially when using a locked-down endpoint that is using a PNAgent site.
So this problem results in users calling the service desk telling that they cannot log in (because they get connected to the ‘hanging’ virtual desktop). They will discover this the next day when they want to login again. And this happens mainly at peak time causing queues at the service desk because every virtual desktop has to be restarted manually.
Finding and solving the issue(s) that cause a logoff to fail is a very time consuming proces, especially in environments with > 500 applications. So I came up with a simple, yet very effective work-around.
In a XenDesktop environment a virtual desktop communicates with the broker using the ‘WorkstationAgent’ service. When stopping this service the broker marks the virtual desktop as unregistered. Now after 4hr the broker will poweroff the virtual desktop which automatically solves the issue. We can use this information to create a work-around for the ‘haning’ virtual desktop problem.
We have to stop the ‘WorkstationAgent’ service directly after the logoff is initiated. This has to be done very early in the logoff sequence. A great way to trigger this is to make use of the external tasks feature in RES Workspace Manager. In this way we can execute a command line task at logoff.
To allow users to stop the ‘WorkstationAgent’ service we have to change the service rights. This is easely done with SetACL from Helge Klein:
SetACL.exe -ot srv -on WorkstationAgent -ace “n:users;p:start_stop,read” -actn ace
That’s it, with this work-around in place you have created some rest for yourself to search for the real cause and solution for the underlying problem!