How can I restore a remote desktop session to the local console?

Solution 1:

  1. Create a desktop shortcut by right clicking on the desktop and selecting new, then select shortcut.
  2. In the text field enter:

    %windir%\System32\tscon.exe 0 /dest:console (See below)

  3. Right click the newly created shortcut, click properties.
  4. Click the shortcut tab, and click the Advanced button.
  5. Check the "Run as administrator" box and click OK.

If this doesn't work, try changing the number zero (tscon.exe 0 /dest...) in step 2 to the number one, and if it doesn't work, keep incrementing it until your remote desktop is released.

Alternately, open up a shell with start menu, run, cmd. Type qwinsta Enter, and look for the ID of the session that is in the active state (it will have a > character at the start of its session name). That's the number you need to use in step 2.

When you want to restore the console desktop, just double click on the shortcut and allow the administrator access.

Solution 2:

Here's a version which avoids the dependency on GNU tools. It uses findstr, which is shipped with Windows.

for /f %%i in ('qwinsta ^| findstr /C:">rdp-tcp#"') do set RDP_SESSION=%%i
:: Strip the >
set RDP_SESSION=%RDP_SESSION:>=%
tscon %RDP_SESSION% /dest:console