Can the GUI of an RDP session remain active after disconnect

This could be a workaround, altough I have not tried it myself and it involves having >another machine

Let's assume that at the moment you are creating a session to myserver.com

Local Client ----> myserver.com

Instead of doing that, you could try having a separate server (let's call it myslave.com) and use that to establish a session

Local Client ----> myslave.com ----> myserver.com

Then if you disconnect the Local Client ---> myslave.com session the GUI of the session
between myslave.com ----> myserver.com should remain active

If you are using a windows server you don't even need another machine.

1) Connect to the server with the remote desktop connection (#con1).

2) Create a new alias for your server system like "127.0.0.2" in Windows\System32\drivers\etc\hosts .

3) Now establish a new remote desktop connection from your windows server (in #con1) to itself (#con2).

4) Finally start your GUI needing application e.g. UI-Path in #con2 and then close #con1.

Yes, you can.

There are two types of sessions in Windows: The "console" session which is always active, and there can only be a max of one of, and "terminal" sessions, a la RDP. Using "rdpwrap" on Github, you can have an unlimited number of terminal sessions.

RDP sessions will become "deactivated" when there is not a connection to them. Programs will still run, but anything that depends on GUI interaction will break badly.

Luckily, we may "convert" a terminal session into a console session instead of disconnecting from Remote Desktop normally by running the following command from inside the terminal session:

for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (tscon.exe %%s /dest:console)

This will disconnect you from the session, but it will still run with full graphical context. This answers your question. You can reconnect to it and it will become a terminal session again, and you can do this infinitely. And, of course, autohotkey works perfectly.

But, what if you need more than one persistent, graphics-enabled session?

To get an unlimited amount of graphics-persistent sessions, you can run Remote Desktop and start terminal sessions from within the "main" session described above. Normally Remote Desktop prevents this "loopback" behavior, but if you specify "127.0.0.2" for the destination, you will be able to start a terminal session with any number of the users on the remote machine.

The graphics-persistentness will only be present on terminal servers if they are not minimized, unless you create and set RemoteDesktop_SuppressWhenMinimized to 2 at the following registry location:

HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client

With this you can get an unlimited number of completely independent graphics-persistent remote sessions from a single machine.


I found a similar way. I had same problem, i downloaded rdp wraper which allows you configure multiple session rpd server and one tool which is included (rdpchecker.exe) allows you connect to localhost so you can connect to your server from your server and you dont need that middle client.


This could be a workaround, altough I have not tried it myself and it involves having another machine

Let's assume that at the moment you are creating a session to myserver.com

Local Client ----> myserver.com

Instead of doing that, you could try having a separate server (let's call it myslave.com) and use that to establish a session

Local Client ----> myslave.com ----> myserver.com

Then if you disconnect the Local Client ---> myslave.com session the GUI of the session between myslave.com ----> myserver.com should remain active.

It will work only if you are connected to the console session of myslave.com.