How do I prevent lock screen of remote computer when remote RDP connection into the computer is started?

You purchase a license that allows you to run the RDP host as a terminal server. The reason the screen locks like this when using RDP is that consumer licenses of Windows allow no more than one active session at a time. The only reliable way around this that lets you continue to use RDP is to get the system licensed as a terminal server, which is expensive and may require an Enterprise or Education edition license.

Alternatively, there are multiple other options for remote access to a Windows system. If you only care about access from the local network, VNC is probably your best bet (unless you need the session to be encrypted). If you need offsite access, you can find a number of options for it online that not only don't involve RDP, but also give a nice visible indication that someone is remotely connected to the session (and often provide some kind of chat functionality for the local user to talk with the remote user).


I found a solution in lieu of rebooting:

  1. Open Command Prompt, issuing query session to get the Session ID of RDP
  2. Paste the below content into %UserProfile%\Desktop\close.bat, replacing SessionId with the result of Step 1:
    echo off
    Tscon %SessionId% /Dest:console
    
  3. Run close.bat as Admin instead of disconnecting from the session

Based on Urumanathan Palanivel's answer, following CloseRdp.cmd could be used;

    @echo off
    for /f "tokens=1,2,3 delims= " %%i in ('query session ^| findstr "Active"') do set SessionId=%%k
    Tscon %SessionId% /Dest:console