A. Normally, when you close a TS RemoteApp, you simply close the application window, which stops the application’s process on the terminal server. If no other applications are running in the session, the Terminal Server then disconnects and logs off the session that was hosting the RemoteApp. Using the TS RemoteApp environment, there is no way to disconnect from an application without closing it.
The best way I’ve found to disconnect the session is by using the Tsdiscon command. To use the command you first need to find your session number using the Query session command. For example, I am running a TS RemoteApp on the server savdalts01. I can query all the sessions on that server, by using the following command:
C:\Users\john>query session /server:savdalts01
The command’s output is this:
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
console 1 Conn
rdp-tcp#1 john 2 Active rdpwd
rdp-tcp#0 savadmin 5 Active rdpwd
rdp-tcp 65536 Listen
From the output, I see that my session is session 2. I can force a disconnect from that session by running the following Tsdiscon command:
C:\Users\john>tsdiscon 2 /server:savdalts01
Next time I launch a TS RemoteApp on the server, the application will open again, with its state maintained.