Is it possible to connect via Remote Desktop Connection to a windows 7 machine without locking the remote computer (I want to use the same logged in user)? Or is it possible to release the lock after the remote desktop session is closed?

11 Answers 11


Just run this from a remote session:

tscon %sessionname% /dest:console
| improve this answer | |
  • Get the error Sessionname %sessionname% not found, any ideas? Guess it is not defined under Windows 8 – Felix Oct 27 '13 at 11:06
  • Not sure about Windows 8, this worked for Windows 7. – Ryan Oct 28 '13 at 18:56
  • 4
    @phil I got that 'error' from his ans on 7 too. Apparently social.technet.microsoft.com/Forums/windows/en-US/… For XP: tscon 0 /dest:console For 7: tscon 1 /dest:console <-- run on the remote machine. BUT.. this is just so that when the client(mstsc.exe) computer disconnects from the comp it is viewing, then it won't lock. So you disconnect by running that command on the comp you are viewing. But that method won't stop it locking the screen when you log in. – barlop Jun 6 '14 at 9:26
  • %sessionname% isn't available from an elevated (administrator) command prompt, presumably because windows treats the admin prompt as a separate non remote session. However tscon.exe requires admin rights to end a session. The solution is to use the above command in a shortcut and to select "run as administator" in the advanced options (also works if you point a "run as administator" shortcut to a batch file with the necessary command and pass %sessionname% to the elevated batch file as an argument. I use this to disconnect without locking and suspend the PC at the same time) – Jules Jan 2 '18 at 20:04

You can use this PowerShell script, which also supports Windows 8:

$server   = 'MyServer'
$username = $env:USERNAME

$session = ((quser /server:$server | ? { $_ -match $username }) -split ' +')[2]

tscon $session /dest:console
| improve this answer | |
  • This didn't work for me at all. I just get "access is denied." It seems like it is trying to match the session on the other end with your local username? But I want to connect to the console session, which could be logged in as a different user. – Dan Jan 6 '16 at 18:13
  • @Dan So why are you using the $env:USERNAME if you don't want to use it? Use the username you want to use instead. You should always think while copy&pasting anything. It may cause you pretty bad times if you just execute everything you find somewhere. – David Ferenczy Rogožan Apr 20 '16 at 15:12
  • @Dawid. Um, thanks? I looked at the script and it is pretty harmless. I chose to run it, wondering how it could work. Turns out, it doesn't. So I made a note of that. Bottom line is the script doesn't specify what situations it works in (probably domain user logged on as the same user on that machine). I did try it with a different username, but that didn't work either. – Dan Apr 26 '16 at 19:10

As far as I know, it's not possible to prevent Remote Desktop Connection from locking the computer, but Ultra VNC allows you to remote control another machine without locking it.

| improve this answer | |
  • 4
    Ultra VNC is much slower which prevents me from using it – yossis Dec 8 '09 at 21:46
  • It IS possible... see Felix's answer – JoelFan Aug 12 '15 at 15:16

refer to https://techjourney.net/remote-desktop-connection-without-locking-remote-computer-session-on-disconnect/

If you need to unlock the remote computer after closing the Remote Desktop Connection, here’s a trick which you can use to force RDP to disconnect without locking the session and logged local user back in on the local console screen upon disconnection of Remote Desktop Connection.

On the remote system connected through RDC (not on your computer which RDC is initialized to connect to remote system), open a Command Prompt window as administrator, then run the command depending on the Windows operating system that is running on the remote system.

On Windows XP:

tscon 0 /dest:console

On Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10 or newer:

tscon 1 /dest:console

On Windows Server:

tscon %sessionname% /dest:console

No Locking Local Console when Using Remote Desktop Connection

| improve this answer | |

Take a look at remote assistance. It basically uses the same remote desktop technology under the hood.

You go into the help and support area and create a remote assistance request you can send to the person you want to remote at the same time.

Alternatively you could use Logmein.com and install LogmeinFree which enables you to remote control a users pc at the same time they;re using it.

| improve this answer | |
  • 4
    Remote assistance requires renewing the ticket, no? – yossis Dec 8 '09 at 21:47

run cmd on remote computer, then run this command query session you will see something like this

 SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
 services                                    0  Disc
>console           SIRS                      1  Active
 rdp-tcp                                 65537  Listen

then run this command tscon x /dest:console where x is your active session ID, which 1 in my case.

| improve this answer | |

As an alternative you can use Gbridge: "Gbridge is a free software that lets you remotely control PCs, sync folders, share files, and chat securely and easily. An extention of Google's gtalk service, Gbridge automatically forms a collaborative, encrypted VPN (Virtual Private Network) that connects your computers and your friends' computers directly and securely. Gbridge has many unique features." http://www.gbridge.com/

| improve this answer | |

It can't be done with RDC itself, you'll need to use a third party tool like TeamViewer. You technically can use remote assistance, but once you're out of requests you can't do anything.

| improve this answer | |
  • TeamViewer looks like a nice app, but I just tested it and it's not completely free and much slower than remote desktop (even when used in a LAN) – yossis Dec 8 '09 at 22:35

Honestly, I would just use RealVNC, I feel its the best remote desktop tool out there. Its very fast, dont get any of the lag with UltraVNC. RealVNC is also excellent when remoting in your computer from outside your house.

| improve this answer | |
  • 2
    As much as I'd like to recommend RealVNC (or any VNC for that matter), I can't (despite having been a very early user of it). RD connections feel much more responsive, especially over bandwidth constrained links. – Brian Knoblauch Dec 8 '09 at 16:19
  • This was my experience also. Remote desktop is much faster, and I yet to find other alternatives (in terms of performance) – yossis Dec 8 '09 at 21:50

Mentioned in another answer, but LogMeIn.com has a free version, and allows you to share the connection with the local user or blank the screen. I have found the response time fairly decent over slower connections, but the graphics quality goes down when speed does.

| improve this answer | |

To solve a similar Task where we had to prevent Screen-lock for a Schedule Task, I've written a Batch File which looks like this:

for /f "tokens=3-4" %%a in ('query session %username%') do @if "%%b"=="Active" set RDP_SESSION=%%a
tscon %RDP_SESSION% /dest:console

This also requires Admin Rights for execution but it's pretty handy as a shortcut on the user's desktop.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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