I just recently came across a Citrix shared desktop environment that had an abnormality in the log-off process.
Once you or a user were to log off that shared desktop at any time, 90% chance you were going to get a message displaying “The following programs are still runnning; wfshell.exe” with a Cancel or Force log off button.
You could wait around 20 seconds and the session would finally log off but it doesn’t exactly look good for your users and we want log offs to be quick and as seamless as possible.
For me since I knew it was the wfshell.exe process causing the delay I created a log off script on the shared desktop vDisk using a new versioned vDisk witin PVS.
The script was created by batch file in the C:\Windows\System32\GroupPolicy\User\Scripts\Logoff\ directory (local on the vDisk itself). The batch file included the command taskkill /f /im wfshell.exe /t. I then edited group policy locally on the vDisk creating a logoff task under the object User Configuration -> Windows Settings -> Scripts (Logon/Logoff).
What this script does as you can probably tell is end the wfshell.exe process running under that users session when they log off. However it does not affect or end any other instance of the wfshell.exe process running on other sessions.
As a conclusion, log off times reduced to 5 seconds, just how we like it!
wfshell.exe – The Citrix WinFrame Shell manages the envronment of a user session such as drive mappings, shares, printers etc.