Remote desktop connection without locking the remote computer

Just run this from a remote session:

tscon %sessionname% /dest:console

You can use this PowerShell script, which also supports Windows 8:

$server   = 'MyServer'
$username = $env:USERNAME

$session = ((quser /server:$server | ? { $_ -match $username }) -split ' +')[2]

tscon $session /dest:console

refer to https://techjourney.net/remote-desktop-connection-without-locking-remote-computer-session-on-disconnect/

If you need to unlock the remote computer after closing the Remote Desktop Connection, here’s a trick which you can use to force RDP to disconnect without locking the session and logged local user back in on the local console screen upon disconnection of Remote Desktop Connection.

On the remote system connected through RDC (not on your computer which RDC is initialized to connect to remote system), open a Command Prompt window as administrator, then run the command depending on the Windows operating system that is running on the remote system.

On Windows XP:

tscon 0 /dest:console

On Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10 or newer:

tscon 1 /dest:console

On Windows Server:

tscon %sessionname% /dest:console

No Locking Local Console when Using Remote Desktop Connection