Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question
up vote 0 down vote accepted

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|improve this answer
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. – Frankenstein Mar 14 '14 at 15:54

Have you ever tried command line utilities for Remote Desktop services management, e.g. tskill ... or reset session ...?

share|improve this answer
In our scale this needs to be automated 24/7 so a tool for manual cleanup will not help. – Frankenstein Mar 12 '14 at 15:03
@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". – TomTom Mar 14 '14 at 9:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.