Remote Desktop leaves host unresponsive

remote desktop

I have my desktop PC at home set up to accept remote connections, and I often connect to it from work on my laptop via mstsc.exe. However, every time I remote to it, I find when I go home that despite the monitor being on – it's not receiving an image and it looks as though the computer is hibernating/asleep. I basically have to restart it whenever I get home and I know there's an answer for why its doing this.

More details:

  • When exiting the remote session, I have tried both logging off the account, and closing the RDP window without logging off; both give the same result.
  • When I get home to the desktop I of course try moving the mouse, ctrl+alt+del to see if its responsive to restart, multiple key-press to see if I can get any audio out of it; It seems pretty obvious its sleeping/hibernating in some way: Nothing happens in any of these cases and a physical restart is necessary.
  • Both desktop and laptop are running Windows 7 Ultimate.

I'm thinking it really is sleeping/hibernating it, and I'm not sure why because left alone my desktop's power options are set to never turn off the HDD or change its state – I leave it on 24/7.

This could be a stupid error on my part but I just can't see it! Thanks.

Best Answer

Thanks for the link to that other question @quack quixote, the first answer lead me to this post - where the answer goes as follows:

...The following command can be run on the remote computer and it will leave the system unlocked with the account that was used during the remote session logged on.

tscon.exe 0 /dest:console

I connect remotely to my XP Pro system using the credentials of the main account on that machine. I created a batch file that runs that command and placed it in the C:\Windows folder of the remote computer. The batch file is named Disconnect.bat. I then put a shortcut to the batch file in the All Users\Desktop folder. I also changed the shortcut's icon to match the one for "Turn Off Computer" on the Start menu.

Instead of closing the remote desktop connection on my local computer, I double click the shortcut on the remote computer to end the session.

Works great!

Edit: As per the question quack linked: If you get the error: "Could not connect sessionID 0 to sessionname console, Error code 5 Error [5]:Access is denied." - Your sessionID may be another number. In the comments @yossis suggests a script as follows to remedy this:

I managed to make it work by trying different session numbers. The session number is different every time I use remote desktop. So I wrote a small script to try out 10 session numbers: for %%i in (0 1 2 3 4 5 6 7 8 9) do ( tscon %%i /dest:console ) It should be executed as administrator.