Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

I want my sessions to terminate when Remote Desktop disconnects.

Right now I'm doing this manually ala:

alt text

Where I'm selecting End session as the option to When a session limit is reached or connection is broken:.

I'd like to do this with a script, and I want to know what the registry key is that I can set to make this the default behavior.

share|improve this question
up vote 4 down vote accepted

You do not need to edit the registry to do what you want to do, you need to change the Group Policy. Run GPEDIT.MSC and under Local Computer Policy navigate to Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Connections and change the settings under Configure keep-alive connection interval. For an even finer adjustment you might also want to look under Session Time Limits and change the settings under Set time limit for disconnected sessions.


After some more searching I found some Group Policy Management Scripts provided by Microsoft. They come in an installer package which puts all the scripts (and a read me file) in your Program Files folder in a folder called Microsoft Group Policy. There are many scripts for doing different things, and I am sure one of them will do what you want. Without doing any more research on the subject it seems like the script CreateEnvironmentFromXML is what you will want to use. Here is the download link.

share|improve this answer
As I mentioned in the question I want to do this with a script. I have a large number of computers to set up and having to manually go through each one is a bit of a pain. – tzenes Oct 21 '10 at 16:07
ah, i see. i'll look into it a bit more. – ubiquibacon Oct 21 '10 at 16:11
@tzenes I have added new information to my answer that might help you. – ubiquibacon Oct 22 '10 at 2:59

Under HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services, add these DWORD values:


If set to 60000 (milliseconds), the time-outs will be one minute.

Full registry key file:

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services]
share|improve this answer

Try fResetBroken in HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services

share|improve this answer
Didn't work.... – tzenes Oct 21 '10 at 16:06

Not a direct answer, but what I'd do is pull out Process Monitor and watch what happens when I click 'OK' on that dialog after toggling the setting needed.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .