Subscribe to Windows IT Pro
October 22, 2008 12:00 AM

Q. How can I disconnect a Terminal Services (TS) RemoteApp session instead of closing the application?

Windows IT Pro
InstantDoc ID #100588
Rating: (2)
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.

Related Content:

ARTICLE TOOLS

Comments
  • Pedro Chico
    2 years ago
    Nov 24, 2010

    I am migrating a system from ws2003 to ws2008 in which users were able to open one application inside the Terminal Server Web Access, disconnect at any time and reconnect from any intranet computer through an intraweb. Now, with RemoteApp, I can mirror that behaviour, BUT (big but) I cannot disconnect-reconnect. As you say, tsdiscon is the best way to disconnect. Is there any possible way to reconnect to a session given its session id?
    To connect for the first time, i generate an rdp file on the fly in the web server and send it to the client, which will open it and see the remoteapp. It is a system requirement that users can turn their computers off while long calculations continue working in the server.

    Hope that you have any idea. Many thanks in advance and congratulations for your article.
    Pedro Chico.

  • Heid
    2 years ago
    Sep 30, 2010

    Since RemoteApp is running on top of terminal services, with the remote application in focus, you can press Ctrl-Alt-End to bring up the remote system's Ctrl-Alt-Delete page. If you close the RemoteApp window here, it will give you the disconnect warning the same as a full desktop session.

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.