Session logout: force termination of application on Windows Terminal Server 2008 and higher

11,637

You might be able to fix this by setting the AutoEndTasks registry value to "1" (REG_SZ).

The default is "0":

Processes do not end automatically. The system waits until the process ends, and, if the process takes more time than the value of the HungAppTimeout entry, the End Task dialog box appears, stating that the application cannot respond to the End Task request.

You can tweak the timeouts by configuring the following registry values:

As @Frankenstein points out, AutoEndTasks could potentially terminate programs, not saving changes to open documents, two points are worth taking into account:

  • This would likely only be a (potential) issue if users are logging off full desktop sessions, without saving their work. For seamless applications, users cannot easily trigger the logoff process, without actually closing their remote applications.
  • Even running the (minor, in my opinion) risk of users losing changes in open documents, consider the administrative implications, of not terminating applications, that do not respond to the close signal. Scheduled maintenance that requires reboot (e.g. patching), can be stalled by a user that haven't saved his Word document. Administrator initiated session logoffs may not complete etc.

From an administrative standpoint, I think AutoEndTasks is necessary. If you want to buy users more time, you can configure the WaitToKillAppTimeout registry value.

Share:
11,637

Related videos on Youtube

Frankenstein
Author by

Frankenstein

Updated on September 18, 2022

Comments

  • Frankenstein
    Frankenstein over 1 year

    In a pure Windows based Terminal Server Environment I am looking for ways to force the termination of an application after session logout/timeout.

    With Citrix services I could use HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Citrix\wfshell\TWI to list all applications that should be terminated immediatly. But without Citrix I do not know if this is possible at all. I hope there is another registry entry for this purpose?

    Background info: some misbehaving drivers are causing that the sessions will stay open after logout for longer periods of time. If we could register the apps that can be terminated safely the cleanup process will free the resources for the sessions much quicker. In our Citrix Environment this had tremendous impact thus we are looking for a solution for our pure Windows Environment too.

    Thanks!

  • Frankenstein
    Frankenstein about 10 years
    In our scale this needs to be automated 24/7 so a tool for manual cleanup will not help.
  • TomTom
    TomTom about 10 years
    @Frankenstein Not sure how aware you are about the fact that command line utilities can be scripted and running scripts from central management places or at user longin / logout is like "administration for beginners".
  • Frankenstein
    Frankenstein about 10 years
    The AutoEndTask forces every app to terminate after session logout. This means an open word document will not even ask to save a file that has been changed. It does solve the resource problem but it can not be used in a user frienly terminal server environment. The nice thing about the Citrix TWI registry is that you can define the app names that can be terminated after logout. I am really surprised that Microsoft has not adopted this approach.