No announcement yet.

Force close application on session logoff

  • Filter
  • Time
  • Show
Clear All
new posts

  • Force close application on session logoff


    This has been driving me nuts!!!

    To summarise first, I need a command line utility which when called will allow a disconnected TS session to log itself off and brutally force close any running apps. Neither "logoff" nor "shutdown /l /f" are working in this instance because of a stubborn app that refuses to close without user interaction.

    To explain in more detail, I have a 2003 64bit enterprise based citrix PS4 farm delivering data analysis apps to researchers who start apps running (analysing) and disconnect their session until after the process completes (this may be anwhere between an hour and several days depending on complexity). What I'd like to do is allow any app that can issue shell commands to be able to logoff the session when finished by adding a shell command as the last line of code. I have found 2 command line options so far: logoff and shutdown /l. However one of the apps (Stata) refuses to close on the the user logging out and gives a "close me before exiting windows" type message box instead, blocking the logoff. So I need a command line utility for logging out a disconnected TS session that also force closes any running processes associated with that session (and only that session). shutdown /l /f sort of does it, but in Stata it first gives the same "close me first" dialog, then only after the "ok" is pressed does it force close Stata. This still requires user interaction, and hence doesn't fulfil the requirement of a disconnected session being logged out when it's done whatever it's doing.

    Any ideas anyone? Been round the web houses 15 times with this to no avail....

    Many thanks.


  • #2
    Re: Force close application on session logoff

    No idea if it will work or not, but what the hey... try psshutdown from SysInternals. Little more robust than shutdown.exe in some scenarios.
    Gareth Howells

    BSc (Hons), MBCS, MCP, MCDST, ICCE

    Any advice is given in good faith and without warranty.

    Please give reputation points if somebody has helped you.

    "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

    "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.


    • #3
      Re: Force close application on session logoff

      Works!! Many thanks Gareth, psshutdown appears to be the Schwarzenegger of shutdown apps.