Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

4 Answers 4

up vote 2 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.

Update:

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

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

http://technet.microsoft.com/en-us/library/cc785966(WS.10).aspx

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

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

MaxDisconnectionTime
MaxIdleTime

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

Full registry key file:

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services]
"MaxDisconnectionTime"=dword:0000EA60
"MaxIdleTime"=dword:0000EA60
share|improve this answer

Your Answer

 
discard

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.