Monday, February 6, 2012
How to stop Remote Desktop from locking screen in Windows 7
I love remote desktop. It's convenient, fast, and easy to set up. There is a downside though: whenever you connect to a remote computer, it locks the screen of that computer when it gives you control. When you disconnect, the remote computer doesn't unlock. So, you would need to have the machine be physically present with a mouse and keyboard attached, so that you can unlock it. Kind of defeats the purpose of remoting in, right? So much for having my spare computer hooked up to a tv that is controlled only by remoting in. I could use LogMeIn, but that's web-based so it is a lot slower than remote desktop.
Until tonight. All the advice I found says that a simple batch file will fix it. Excellent! All I needed to do was create a batch file to execute the "tscon.exe 0 /dest:console" command. That was easy.
It also didn't work. From what I understand, this command tells the computer to restore itself to the previous session before it was remoted into. On older machines, the default session was named 0. Therefore, the batch command was "tscon.exe 0 /dest:console". But, after XP SP3, Microsoft updated this for security reasons, and session 0 became a locked session.
So I figured, if they locked session 0, then my default session must be 1. All the advice I found online was old and still used session 0 in their batch file. I tested that, and it definitely doesn't work. Since I guessed we must now be session 1, I changed my file to that, and voila, it worked!
The steps to doing it were all very easy.
All of this was tested on machines running Windows 7 Ultimate, 64-bit
1- Now, I created a batch file. Open 'notepad' with administrator privileges, and enter this: tscon.exe 1 /dest:console
2- Click "save as"
3- Pick a name for the file (I use "disconnect") and use the .bat suffix. The file will then be named "disconnect.bat"
4- In the dropdown menu for save as type, select "all files" instead of .txt
5- The location is the Windows folder on the C: drive
6- Since you are running notepad with Admin privileges, it lets you save to the windows folder
7- Navigate to the file, right-click, click make shortcut
8- Have it place the shortcut on the desktop
9- Now, when I am done working on the remote computer, instead of the usual "end session" button or
whatever, I right click on the "disconnect.bat" shortcut on the desktop and run it as administrator. (If the file isn't run as administrator, it won't work)
10- Give the computer permission to run the file as admin by clicking yes. It will say "your remote session has ended" and boot you off
11- When the .bat file disconnects you on the machine you're sitting at, it simultaneously unlocks the screen on the remote machine
What a major annoyance now dealt with.