Adam Jarret


Stop Remote Desktop from Locking the Host

| Tags: fyi, remote-desktop, windows

Closing a Windows Remote Desktop connection leaves the host machine locked, but it is possible to create a shortcut that will close the session without locking the screen.

To create the shortcut:

  1. Right click on the Desktop and select NewShortcut

    New shortcut dialog screen shot

  2. For Windows 7/Vista hosts, enter the following:

    %windir%\System32\tscon.exe %sessionname% /dest:console

    Update: After a recent system update, using the %sessionname% variable started causing an error. I switched to hard-coding 1 instead and this has worked so far.

    %windir%\System32\tscon.exe 1 /dest:console

    For Windows XP hosts, enter the following:

    %windir%\System32\tscon.exe 0 /dest:console

  3. Click Next, enter a name for the shortcut and then click Finish. The name can be anything you like.

    New shortcut dialog screen shot

  4. On Windows 7/Vista hosts, this shortcut needs to be run with administrator privileges. Right click on the newly created shortcut and select Properties.

  5. Click the Advanced button on the Properties window.

  6. Check the box marked Run as administrator and then click OK.

    New shortcut dialog screen shot

Pin the shortcut to the Start menu or the taskbar and click it when you would like to disconnect.


Keith on 19 Apr 2013 at 2:02 pm
Thanks soooo much. I looked all over for information to accomplish this. Your solution works great. My only observation is that using this in a network environment when I log in as the actual administrator it works, but when I try to use it as another user who has remote access privileges, the disconnect doesn't seem to work, even though I checked the "Run as Administrator" box. A minor issue at the moment...Thanks again!!
PrazAU on 21 Aug 2013 at 12:14 am
This solution work great for me as well. That exactly what I was searching as well. Thanks heaps Cheers Praz
Ramesh Tester on 26 Feb 2014 at 5:27 am
Hi Adam, I have tried with above solution but seems to its not working for me. I'm using Win 7 machine and prepared shortcut with following command C:\Windows\System32\tscon.exe 1 /dest:console And given a Disconnect as File Name. I open the remote machine and started automation scripts execution on same machine. Then I executed the shortcut file "Disconnect" with Administrator rights and it is executed succssfully. But remote session is not closed, still it is active mode. Kindly help me on this.

Comments are closed for this post.