Wednesday, January 28, 2009

[THIN] Re: have a process still running after seamless app closes

Fabulous Warren! Download pick of the week blogged
http://kenzig.blogspot.com/2009/01/download-pick-tskaasplat-close-and.html

Jim Kenzig
Blog: http://www.techblink.com


On Tue, Jan 27, 2009 at 10:17 AM, Warren Simondson <caditc@tpg.com.au> wrote:
Okay Lan, I like what you've got, but I personally hate scripts, so after seeing that TSKaapop
wasn't exactly what you're after, I went and sat on the dunny and did some thinking.

Guess what, I came up with TSkaaSplat. Now this basically takes what you are doing in you script
and puts it into one .exe. My concern with TASKKILL, which I personally use all the time, is when
you call something like TASKKILL /IM Notepad.exe on a terminal server, it has the potential to
terminate other instantance of notepad.exe outside that current session. Now in most cases it won't
but, it could, and I've seen it happen.

So what I did was create TSKaaSplat to launch the app and then kill any processes that you list on
the command line after the app closes. So you could publish something like:

TSKAASPLAT d:\apps\MSEXCEL.EXE calc.exe virusscan.exe

This will launch EXCEL and when it is closed by the user, it will search that session for the
processes calc.exe and virusscan.exe and kill them. No other session is affected.

I also added a kill ALL option. So for example:

TSKAASPLAT d:\apps\MSEXCEL.EXE *

This will launch EXCEL and when it is closed by the user, it will kill all other processes running in
that session and log the user off. Now everyone's going to say that you can just publish Excel alone
and when you close it, the session will logoff, so what's the point of a Kill ALL option, but how many
people get hung sessions when they close an app because some other little process is working
away in the background? Well this is the answer.

Anyway, this was a very enjoyable challenge, so I hope it helps everyone out there.

As always download it from: http://www.ctrl-alt-del.com.au/CAD_TSUtils.htm

----------------------------------------------------------------------------------
TSKaasplat is a command-line utility to run a single application from one
command with the further ability to close other given processes on exiting
the initial application.
This utility was written to allow a single call to launch an application
in its own process, and on closing that application, other processes within
the same sessions, as specified in the command line,  can be terminated
simutaneously.
TSKaasplat with its parameters can exist as a shortcut on the desktop, can be run
in a script, or published as a single application. TSKaasplat will work as a
Seamless Published application in a Citrix environment. If single applications are
launched via TSKaasplat in a Seamless environment, the session will close after
it has terminated the given processes as listed in the command line.
If for example, notepad.exe is launched via TSKaasplat as the first parameter,
and calc.exe and excel.exe are listed as processes to be terminated upon
notepad.exe closing, then when the user closes notepad in the normal fashion,
calc and excel will be terminated. If this command was presented
as a published application in Citrix or directly called from a Terminal
Services Client, then the session will also close.

Usage:
TSKaasplat [[PATH][Application] [Processname | *] ...] [/?]

 PATH        -  Path to the Application
 Application -  Application Executable
 Processname -  Process name to kill on exiting the application.
 *           -  Kill all session processes on exiting the application and logoff.
 /?          -  Show this help file

TSKaasplat without parameters will display this help file.

NOTE: If a PATH or Application does not exist, TSKaasplat will
terminate at that point. The first parameter must be the initial
application to run.

E.G. TSKaasplat "c:\Program Files\Office11\EXCEL.EXE" notepad.exe calc.exe
This command will launch MS Excel. When MS Excel is closed
by the user, the system will then look for any processes of
notepad.exe and calc.exe running in the same session and
and terminate them if they exist.

E.G. TSKaasplat "c:\Program Files\Office11\EXCEL.EXE" *
This command will launch MS Excel. When MS Excel is closed
by the user, the system will then look for any other processes
running in that session, terminate them and logoff the session

This utility is FREEWARE and was written by Warren Simondson of
Ctrl-Alt-Del IT Consultancy, Australia. www.ctrl-alt-del.com.au

Although written for Terminal Server and Citrix environments, this application
will function on non-TS/Citrix workstations and servers.
This application has been tested on the following platforms:

Windows 2008 Server
Windows 2003 Server SP1 w/ Citrix PS 4.0/ XA 5.0
Windows 2003  Server SP1 (Terminal Server Application Mode)
Windows 2000  Server SP4 w/ Citrix MF XP
Windows 2000  Server SP4 (Terminal Server Application Mode)
Windows 2000  Server SP4 w/ Citrix MF 1.8
The freeware version is offered AS IS. Ctrl-Alt-Del IT Consultancy has made
every effort possible to ensure that TSKaasplat is free of any bugs or errors,
however in no way is TSKaasplat to be considered error or bug free.
You assume all responsibility for any damages or lost data that may result
from any errors or bugs in TSKaasplat.

IN NO EVENT WILL CTRL-ALT-DEL IT CONSULTANCY BE LIABLE TO YOU FOR ANY GENERAL,
SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR OTHER DAMAGES ARISING OUT OF
THIS PRODUCT.





--
Warren Simondson

Ctrl-Alt-Del IT Consultancy Pty Ltd
Website: http://www.ctrl-alt-del.com.au




Quoting TSguy92 Lan <tsguy92@gmail.com>:

> Tskill couldn't find the process name. But Taskkill does, and
> correctly
> drops the offending processes (without killing off other processes of
> the
> same name running in different sessions).
>
> Still have a bit more testing to do with it, but it looks like this
> setup
> will workout for us (fingers crossed ;) )
>
> For the record, I've setup the following:
>
> 2 cmd scripts.
>
> 1st script, runs a "start ctxhide 2ndscript.cmd" then exits
>   - this effectively hides the 2nd cmd file from view
> 2nd script calls the core program exe - start "name" /wait
> c:\pathtoexe(dos
> namming format pathing) -switches
>  - after the core exe closes down, the next line "taskkill /im
> processname"
> drops the systray processes.
>
> Again thanks to all for their input on this issue.
>
> Lan
>
> On Mon, Jan 26, 2009 at 11:26 AM, TSguy92 Lan <tsguy92@gmail.com>
> wrote:
>
> > The start /wait script file seems to be on the right track,
> however, I've
> > run into an odd issue.
> >
> > tskill when called either from script or from the command line
> state's that
> > it cannot find the processes I need to kill by name. If the
> processid is
> > entered instead, the processes die with no issues.
> >
> > since processid is a rather random value, this is something of a
> stumbling
> > block atm. thoughts?
> >
> > Much thanks, feels like we're close to getting this bugger sorted
> out
> >
> > Lan
> >
> >
> > On Mon, Jan 26, 2009 at 10:08 AM, TSguy92 Lan <tsguy92@gmail.com>
> wrote:
> >
> >> Thanks for the feedback gang. Testing out the TSkaapop utility did
> not do
> >> the trick for us. May be related to how the app loads, as we don't
> call
> >> multiple EXE's at once. The core app when launched as a "-" switch
> that's
> >> defined and that calls up the other two EXE's that drop to the
> systray.
> >>
> >> Working on trying out chris's suggestion on using qprocess to see
> if we
> >> can get that to drop the exe's after the core app is closed.
> >>
> >> will let you all know how it pans out.
> >>
> >> Lan
> >>
> >>
> >>
> >> On Sat, Jan 24, 2009 at 6:14 AM, Warren Simondson
> <caditc@tpg.com.au>wrote:
> >>
> >>> Check out a little freeware app called TSKaapop from Ctrl-Alt-Del
> IT
> >>> Consultancy, not to be confused
> >>> with TSKaapow also available from Ctrl-Alt-Del IT Consultancy.
> Download
> >>> it from http://www.ctrl-alt-
> >>> del.com.au/CAD_TSUtils.htm
> >>>
> >>> TSKaapop is a command-line utility to run multiple applications
> from one
> >>> command with the further ability to close those applications
> >>> simultaneously
> >>> with one action.
> >>> This utility was written to allow a single call to launch
> multiple
> >>> applications
> >>> in their own process, ensuring that a user has access to only
> the
> >>> applications
> >>> they require in a single seamless or desktop session.
> >>> TSKaapop with its parameters can exist as a shortcut on the
> desktop, can
> >>> be run
> >>> in a script, or published as a single application that runs
> multiple
> >>> applications, each with its own process. TSKaapop will work as a
> Seamless
> >>> Published application in a Citrix environment. If multiple
> applications
> >>> are
> >>> launched via TSKaapop in a Seamless environment, the session will
> not
> >>> close
> >>> until each application has been closed or the first application
> called in
> >>> the
> >>> command line of TSKaapop is closed. If for example, notepad.exe
> is
> >>> launched via
> >>> TSKaapop as the first parameter, and calc.exe and excel.exe are
> launched
> >>> as the
> >>> second and third parameters respectively, then all three
> applications
> >>> will
> >>> launch, each as a separate process. If notepad.exe is then closed
> by the
> >>> user,
> >>> then calc.exe and excel.exe will also terminate. If this command
> was
> >>> presented
> >>> as a published application in Citrix or directly called from a
> Terminal
> >>> Services Client, then the session will also close. All
> applications
> >>> called by
> >>> TSKaapop can be closed individually, excluding the first launched
> which,
> >>> as
> >>> stated, will close any application called by TSKaapop.
> >>>
> >>> Usage:
> >>> TSKaapop [[PATH][Application] [PATH][Application] ...] [/?]
> >>>
> >>>  PATH        -  Path to the Application
> >>>  Application -  Application Executable
> >>>  /?          -  Show this help file
> >>>
> >>> TSKaapop without parameters will display this help file.
> >>>
> >>> NOTE: If a PATH or Application does not exist, TSKaapop will
> >>> terminate at that point. Any applications launched prior will
> >>> still be operational.
> >>>
> >>> E.G. TSKaapop "c:\Program Files\Office11\EXCEL.EXE"
> >>> c:\windows\system32\notepad.exe
> >>> This command will launch MS Excel and notepad one after the
> other.
> >>>
> >>> E.G. TSKaapop "c:\Program Files\Office11\EXCEL.EXE"
> >>> "c:\windows\system32\notepad.exe
> >>> h:\MyTextfile.txt"
> >>> This command will launch MS Excel and h:\MyTextfile.txt in
> notepad
> >>> one after the other.
> >>>
> >>> This utility is FREEWARE and was written by Warren Simondson of
> >>> Ctrl-Alt-Del IT Consultancy, Australia. www.ctrl-alt-del.com.au
> >>>
> >>> Although written for Terminal Server and Citrix environments,
> this
> >>> application
> >>> will function on non-TS/Citrix workstations and servers.
> >>> This application has been tested on the following platforms:
> >>>
> >>> Windows 2008 Server
> >>> Windows 2003 Server SP1
> >>> Windows 2003 Server SP1 w/ Citrix PS 4.0/ XA 5.0
> >>> Windows 2003  Server SP1 (Terminal Server Application Mode)
> >>> Windows 2000  Server SP4
> >>> Windows 2000  Server SP4 w/ Citrix MF XP
> >>> Windows 2000  Server SP4 (Terminal Server Application Mode)
> >>> Windows 2000  Server SP4 w/ Citrix MF 1.8
> >>> Windows XP Professional (domain member)
> >>> Windows Vista (domain member)
> >>>
> >>> The freeware version is offered AS IS. Ctrl-Alt-Del IT
> Consultancy has
> >>> made
> >>> every effort possible to ensure that TSKaapop is free of any bugs
> or
> >>> errors,
> >>> however in no way is TSKaapop to be considered error or bug
> free.
> >>> You assume all responsibility for any damages or lost data that
> may
> >>> result
> >>> from any errors or bugs in TSKaapop.
> >>>
> >>> IN NO EVENT WILL CTRL-ALT-DEL IT CONSULTANCY BE LIABLE TO YOU FOR
> ANY
> >>> GENERAL,
> >>> SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR OTHER DAMAGES
> ARISING OUT
> >>> OF
> >>> THIS PRODUCT.
> >>>
> >>> --
> >>> Warren Simondson
> >>>
> >>> Ctrl-Alt-Del IT Consultancy Pty Ltd
> >>> Website: http://www.ctrl-alt-del.com.au
> >>>
> >>>
> >>>
> >>>
> >>> Quoting TSguy92 Lan <tsguy92@gmail.com>:
> >>>
> >>> > Afternoon listies,
> >>> >
> >>> > We have an app run in seamless mode, which is used as a starter
> point
> >>> > to
> >>> > ensure that a number of other applications can be started
> within the
> >>> > same
> >>> > memory space (same server).
> >>> >
> >>> > One of the newer applications being launched by this starter
> point,
> >>> > has a
> >>> > secondary EXE process spawned that drops directly down to the
> system
> >>> > tray.
> >>> >
> >>> > All is well and good, until the main starter application is
> closed.
> >>> > The
> >>> > spawned EXE's for the system tray app won't close without an
> end
> >>> > user
> >>> > selecting to exit them specifically.
> >>> >
> >>> > Have attempted the reg mods defined in -
> >>> > http://support.citrix.com/article/ctx891671, but that hasn't
> done it
> >>> > for us
> >>> > so far.
> >>> >
> >>> > I was recall some kind of third party app, "launchit"
> >>> > "launchthis"...or
> >>> > something similar which can watch spawned processes and close
> them
> >>> > out after
> >>> > the initially launched app closes.
> >>> >
> >>> > Not finding it in my searches, curious if anyone else is aware
> of a
> >>> > utility
> >>> > which will help us close out this little bugger of an exe.
> >>> >
> >>> > thanks,
> >>> >
> >>> > Lan
> >>> >
> >>>
> >>> ************************************************
> >>> For Archives, RSS, to Unsubscribe, Subscribe or
> >>> set Digest or Vacation mode use the below link:
> >>> http://www.freelists.org/list/thin
> >>> Follow ThinList on Twitter
> >>> http://twitter.com/thinlist
> >>> Thin List discussion is now available in blog format at:
> >>> http://thinmaillist.blogspot.com
> >>> Thinlist MOBILE Feed
> >>> http://thinlist.net/mobile
> >>> ************************************************
> >>>
> >>
> >>
> >
>

************************************************
For Archives, RSS, to Unsubscribe, Subscribe or
set Digest or Vacation mode use the below link:
http://www.freelists.org/list/thin
Follow ThinList on Twitter
http://twitter.com/thinlist
Thin List discussion is now available in blog format at:
http://thinmaillist.blogspot.com
Thinlist MOBILE Feed
http://thinlist.net/mobile
************************************************

No comments: