Logoff scripts not running with XenApp or RDS published apps

I have had a long couple of weeks looking into an issue where logoff scripts do not run with XenApp 6.5 published applications or with Windows Server 2008 R2 RemoteApp. Logoff scripts work perfectly from a published desktop, or if the user is added to the local Administrators or Power Users group. To make troubleshooting more challenging, sometimes logoff scripts will work…. just sometimes.
The issue appears to be something to do with wfshell.exe as wfshell.exe hangs at logoff for 10 seconds and if an administrator terminates the users wfshell.exe process the logoff scripts run as expected. A fix suggested in the Citrix forums is to add wfshell.exe to LogoffCheckSysModules as described in CTX891671, but this did not work for me.
I ended up rebuilding a XenApp 6.5 server from scratch for the client who was experiencing this issue and the problem went away, so I know it was something installed which was causing the issue but I could not track down the culprit. The looming “solution” was to rebuild the entire farm! Which I was understandably not that happy with, so I decided to log a case with Citrix who ended up providing a workaround which I have successfully tested.
Add wfshell.exe to the list of processes RDS may safely terminate by adding an entry to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Sysprocs
wfshell.exe = 0 (REG_DWORD)
I pushed this entry out to the farm using Group Policy Preferences which is easy, and ensures the setting will always apply to all farm servers.

5 Comments

  1. Anonymous says:

    I dont know why but wfshell.exe gets lost from …SysProcs everytime I reboot the server.

  2. Someone on the Citrix forums also mentioned this. I have applied the registry entry using Group Policy Preferences so have not noticed this issue. Can you try setting this via GPP?

  3. Anonymous says:

    can you specify how to do this in GPP please?

  4. macgor says:

    From : http://support.citrix.com/article/CTX137340

    Unable to Add Wfshell.exe to Microsoft SYSPROCS Registry Key

    Symptoms or Error
    Unable to add Wfshell.exe to registry key sysprocs.

    Solution
    Wfshell.exe should not be included the registry key sysprocs.
    Caution! Refer to the Disclaimer at the end of this article before using Registry Editor.

    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerSysprocs

    Problem Cause
    The registry key sysprocs is very similar to Citrix LogoffCheckSysModules key. It used to terminate open processes after a Remote Desktop Session is closed.

    XenApp is hard coded to validate Wfshell.exe is in the registry key sysprocs.

    If XenApp determines Wfshell.exe is listed in the registry key sysprocs, the file is removed from the registry key causing problems with the XenApp environment.

    It’s was my case, i tried to add this registry key to my Citrix Farm XA6.5, but after reboot, she disappeared…

Leave a Reply

Contact Deptive

Location
Deptive - Commercial Bay
11-19 Customs Street West St
Commercial Bay Tower, Level 17, Room 1715
Auckland 1010
We also have a virtual office in Wellington.

Contact Details

0800 000 141

Postal Address
PO Box 34797,
Birkenhead, Auckland 0746