Switch your HTPC back to Media Center after logging out of Remote Desktop

Share

I have a Windows 7 Media Center PC hooked up to the TV in our living room.  It’s paired to a 4-stream Ceton CableCard adapter and is great for watching both TV and movies.

Sometimes I need to Remote Desktop (RDP) into the machine to install updates or make other changes.  During this, and after logging out, the Media Center PC is left at the login-screen on the TV.  So the next time I sit down to watch TV, I have to find the wireless keyboard and enter my password to log back in.

Since this can get annoying, I’ve created a small script on the desktop that automatically switches the console session (what’s shown on the TV) back to the primary user and re-starts Media Center.  This way, the next person that uses the TV doesn’t have to log back in.  When I’m done in the RDP session, I simply start the batch script and it logs me out of RDP and logs the TV back in.

Here’s the simple script:

call %windir%\system32\tscon.exe 1 /dest:console
start "Media Center" /max %windir%\ehome\ehshell.exe
exit /b 1

  1. Jeff
    September 29th, 2012 at 12:35 | #1

    I’ve always been a fan of tscon 🙂 nice

  2. Hugo L
    October 18th, 2012 at 06:10 | #2

    I have exactly the same use case and was glad to find this.

    Note that I found it necessary to run this as adminstrator even when the current user is member of Administrators. How reliable is the assumption of session ID of 1? One can run query user to find session numbers.

    • October 18th, 2012 at 06:55 | #3

      I think for auto-login (which my media center is setup as), Session 1 should be the auto-login.

  1. No trackbacks yet.