Paul Kiddie

Preventing lock screen from appearing after you’ve remoted into a host through Remote Desktop

January 12, 2009

I’ve been trying to perfect my HTPC setup recently, the latest addition being a Logitech Harmony 555 remote which lets me control all my devices from one remote control. It’s based on activities like ‘Watch Sky’,‘Play XBOX 360’ and ‘HTPC’ and switches the appropriate inputs on my TV, amp, and other devices, and assigns the volume control to the amp rather than the TV which is great. I’m also using a free utility, Human Interface Programmer, on the HTPC, which allows you to assign custom commands to remote control presses based on application profiles, and works with the Media Center remote and receiver. By default it emulates the media center keypresses when it detects the media center app being started, but I’ve also set up one to work with media player classic so the aim is to control everything from the remote, even mouse movements.

I remote in pretty regularly to the HTPC to initiate large file transfers and it’s always a pain when I come to watching anything on the HTPC that I have to re-enter my password after having accessed it remotely as it locks the host session, difficult without a keyboard/mouse. I wondered if there was a way this could be avoided, so when I disconnect from the remote session, the host session becomes active once more (back to the desktop). Found a great forum post on Soft32 at that explains the necessary steps.

You need to use the tscon.exe command line utility in the following manner:

tscon 0 /dest:console

This will disconnect the remote session and unlock the existing session on the host and is exactly the behaviour I needed. You cannot automate it any further, for example, when you press the Disconnect, or close the remote session’s window, but I’ve created a shortcut on the desktop which runs tscon as above and it works great. Probably not recommended if you are remoting into a machine you don’t have physical access to afterwards, as it will leave the machine in an unlocked state, but this is fine for the HTPC.

👋 I'm Paul Kiddie, a software engineer working in London. I'm currently working as a Principal Engineer at trainline.