Remote desktop connection without locking the remote computer

32

17

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?

yossis

Posted 2009-12-08T11:59:52.977

Reputation: 433

Answers

16

Just run this from a remote session:

tscon %sessionname% /dest:console

Ryan

Posted 2009-12-08T11:59:52.977

Reputation: 261

%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 – 2018-01-02T20:04:12.970

Get the error Sessionname %sessionname% not found, any ideas? Guess it is not defined under Windows 8 – Felix – 2013-10-27T11:06:22.520

Not sure about Windows 8, this worked for Windows 7. – Ryan – 2013-10-28T18:56:23.680

4

@phil I got that 'error' from his ans on 7 too. Apparently http://social.technet.microsoft.com/Forums/windows/en-US/0c9318bf-47b7-4286-b957-4f972b0d15cf/rdp-disconnect-and-not-lock-session?forum=w7itproui 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 – 2014-06-06T09:26:21.477

6

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

Felix

Posted 2009-12-08T11:59:52.977

Reputation: 201

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 – 2016-01-06T18:13:32.187

@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. – Dawid Ferenczy Rogožan – 2016-04-20T15:12:41.200

@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 – 2016-04-26T19:10:19.797

4

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.

raven

Posted 2009-12-08T11:59:52.977

Reputation: 5 135

It IS possible... see Felix's answer – JoelFan – 2015-08-12T15:16:47.883

4Ultra VNC is much slower which prevents me from using it – yossis – 2009-12-08T21:46:41.030

4

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

Pete Whitfield

Posted 2009-12-08T11:59:52.977

Reputation: 41

2

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.

SIRS

Posted 2009-12-08T11:59:52.977

Reputation: 145

2

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.

daed

Posted 2009-12-08T11:59:52.977

Reputation:

4Remote assistance requires renewing the ticket, no? – yossis – 2009-12-08T21:47:49.483

1

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.

techturtle

Posted 2009-12-08T11:59:52.977

Reputation: 8 059

1

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/

Nicu Zecheru

Posted 2009-12-08T11:59:52.977

Reputation: 5 234

1

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.

John T

Posted 2009-12-08T11:59:52.977

Reputation: 149 037

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 – 2009-12-08T22:35:34.643

1

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.

Mike K

Posted 2009-12-08T11:59:52.977

Reputation: 89

2As 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 – 2009-12-08T16:19:00.643

This was my experience also. Remote desktop is much faster, and I yet to find other alternatives (in terms of performance) – yossis – 2009-12-08T21:50:13.597

0

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.

Smartis

Posted 2009-12-08T11:59:52.977

Reputation: 176