Re: How to make a user close a program when they disconnect a TS Session

From: Alex K. Angelopoulos [MVP] (aka-at-mvps-dot-org)
Date: 06/07/04


Date: Mon, 7 Jun 2004 08:53:01 -0500

Retrying this post again... :)

John,

As a general case, this can't be done, but I don't think you're necessarily
worried about all situations.

Could you explain more about the problems you are trying to resolve
specifically, the constraints you have on acceptable solutions, and how your
users connect to your TS if there is a specific client or technique they
use? Also please include the specific applications they are typically using
in these sessions.

The reasons this isn't easy go back to some details of what can and will
happen in TS sessions. Just to review a few of them (most of which you
probably know):

+ User sessions can and will disconnect due to line conditions at times,
particularly in WAN environments. This is of course less of a problem with
Win2003, especially with autoreconnect.

+ Users can kill off connections by forcibly terminating the host
application: a minor subset, and not likely to be significant for you.

+ There is no real in-session event that has a response defined for it when
a user disconnects - unlike logoff, where a script can be run when logoff
initiates.

There are workarounds possible for most situations. For example:

+ If you're running Office applications and users claim that they're logging
off even though sessions show up disconnected later, they may be running
into a problem with a couple of background applications from Office. If they
are performing application-based logons, a workaround can be scripted for
this.

+ If users are being randomly disconnected, you have a whole barrage of
options you can try to both prevent the problem and make recovery without
zombie sessions easier. Those include: setting 1 session per user and
allowing reconnect from any client in policies; making sure that
Autoreconnect is enabled clientside; and a few techniques to reduce odd
packet frag problems that typically cause this.

+ If users simply choose disconnect instead of logoff from the security
menu, you can actually remove the Disconnect... item so it does not show up
in sessions.

+ If users are being forgetful and closing down the session by hitting the
"X" in the TS client window, you can intercept this in an HTML or HTA based
interface and prompt them to shut down - or even cancel the close and simply
call the Logoff() within the session, giving them the opportunity to shut
down applications or cancel the logoff.

It's rather messy due to the underlying Windows infrastructure that TS has
to work with, so we won't have a 100% solution I suspect, but I do think a
90% plus solution is probably possible.

John Faris wrote:
> Hi all.
>
> My users login to 2003 TS sessions and run a couple of applications.
> The trouble is they usually don't logoff but disconnect the session
> instead. I know you can force logoff but I would rather find a way to
> prompt the user to cleanly close the applications down when they
> disconnect. Ideally this would with some form of script based prompt
> along the lines of "Please close program x before closing Remote
> Desktop" and then prevent the session from disconnecting. I have
> searched google and various websites but I cannot seem to find the way
> to achieve this. Maybe better to post in scripting groups? Anyone out
> there done anything similar?
>
> Thanks.
>
> John.



Relevant Pages

  • How to make a user close a program when they disconnect a TS Session
    ... My users login to 2003 TS sessions and run a couple of applications. ... trouble is they usually don't logoff but disconnect the session instead. ...
    (microsoft.public.scripting.wsh)
  • How to make a user close a program when they disconnect
    ... My users login to 2003 TS sessions and run a couple of applications. ... trouble is they usually don't logoff but disconnect the session instead. ...
    (microsoft.public.windows.terminal_services)
  • RDP permissions
    ... sessions and be able to logoff and/or disconnect specific ones without ...
    (microsoft.public.windows.terminal_services)
  • Re: Blue screen of death when closing connections
    ... seems to be directly related to the connection failures, ... that the automatic disconnect settings in the user profiles get ... > Do the sessions get disconnected while the user is actively using ...
    (microsoft.public.windows.terminal_services)
  • RE: Remote Desktop on Windows 2003
    ... sessions by stopping and starting on of the services on the server. ... we cannot simply disable some services to disconnect ... Open Remote Desktop Connection. ...
    (microsoft.public.win2000.general)