How to end a RDP session without locking

 

Why would you want to end your RDP session without locking your machine? Well, there are some scenarios where an application will only work if your machine is not locked (In-Home Streaming). Or maybe you just want an easy way to end your RDP session, but you can’t do it the regular way because you’re several layers deep.

If you do your research online, it might be tough to find a simple solution. The only thing that you’ll see in common is the usage of the tscon.exe command. Withoutthesarcasm suggests that you use a for loop to manually close specific remote sessions ID numbers. Digitalmediaphile suggests that you create a batch file that essentially does the same thing, but to RDP session names (like RDP-Tcp#1).

Actually, in my opinion, the best way to do this is with a simple session variable. I actually got this info from a Steam forum. Just create a shortcut with this value:

C:\Windows\System32\tscon.exe %sessionname% /dest:console

No for loops, no batch files, no guesswork. Your exact remote session will be closed and your machine won’t be locked. It’s funny how so many people can think of so many ways to do the same thing.

Update as of 2020/05/05

Unfortunately this blog post is no longer relevant as it does not work with the latest version of Windows 10.

2 comments

  1. This didn’t work for me. When running as a normal user, access is denied. When running the command in an administrator command prompt, the %sessionname% variable isn’t set.

Leave a Reply to Gary Cancel reply

Your email address will not be published. Required fields are marked *