locked
TerminateChildProcesses when the parent is your own UserScripts pre-launch code RRS feed

  • Question

  • Hello

    We have an app-v 4.6 package that I am trying to convert to app-v 5.1.  In this package the product does not work right unless we use a pre-launch script to run this little "graphic server" exe.  when you run this app for real (fat install) it is not required, but it is when virtualized.  In the app-v 4.6 package we used the <VIRTUALENV TERMINATECHILDREN="TRUE"> value in the OSd to make sure this little process closed when the user closed the main program.

    In app-v  5.1 I can get the process to run at launch fine, but cannot figure out how to close it.  (code below)

    So in App-v 5.x it looks like the way TerminateChildProcesses works now is you must specific the parent program - and when the parent closes App-v terminates that parents children.  Sounds more precise than app-v 4.6.  But what is the parent to my little exe, ?  none other than App-V itself, appvclient.exe

    I actually tried to add that into my config but of course it does not work - in part because appvclient.exe does not close - and it is not part of the virtual package anyway..

       <UserScripts>
      <StartVirtualEnvironment  RunInVirtualEnvironment="true">
            <Path>[{AppVPackageRoot}]\VFS\SystemX86\GSW32.EXE</Path>
            <Arguments></Arguments>
          </StartVirtualEnvironment>
     </UserScripts>

    So - is this possible or should I think of a different way to get my little program to run in the package?

    Thanks

    Tuesday, February 2, 2016 6:35 PM

Answers

  • Honestly do not know what you mean by appv tokens.  I used the same applicationID's that are listed in the user config xml file under the   <Applications> section and nothing worked.  But that is ok, as I came up with another idea.

    Since I cannot figure out how to use exitprocess right I decided I can do that myself.  What I did this morning is change my application to nothing.exe (a tool I believe you can get from Tmurgent's website) and use my own launch script under UserScripts which will run the gsw32.exe program, then the real program and wait for the real program to close.  When the script continues past that it closes the gsw32.exe on it's own.  This is the kind of thing we had to do in some cases in app-v 4.6, usually because of that old issue where programs closed exactly 10 minutes after launching them.

    Thanks for you help anyway

    Bruce

    • Marked as answer by BSpies1 Wednesday, February 3, 2016 3:30 PM
    Wednesday, February 3, 2016 3:29 PM

All replies

  • 1) Can you look at this process with Process Explorer (procexp.exe)?  It will show you the process tree.

    2) AppV5 does support running a script when a specific .exe is terminated.  Maybe try a script there?

          <ExitProcess>

            <Path>taskkill.exe</Path>

            <Arguments>/im "program.exe" /f</Arguments>

            <Wait RollbackOnError="false"/>

            <ApplicationId>[{AppVPackageRoot}]\Contoso\ContosoApp.EXE</ApplicationId>

          </ExitProcess>



    Tuesday, February 2, 2016 10:16 PM
  • this sounds like a winner but I cannot get the ExitProcess to 'fire'.  There are 2 application ID's in the package and neither seem to do it.  I have validated the taskkill command should work as well.  Process Monitor shows no attempt to execute taskkill.exe either.  I assume ExitProcess works by watching the target of ApplicationID, and acts when that process exits. 

    also as requested here is a screenshot from Process Explorer.  It seems when you use the XML script to launch something it is app-v itself that would be the parent which I guess makes some sense.

       <UserScripts>
      <StartVirtualEnvironment  RunInVirtualEnvironment="true">
       <Path>[{AppVPackageRoot}]\VFS\SystemX86\GSW32.EXE</Path>
       <Arguments></Arguments>
      </StartVirtualEnvironment>
      <ExitProcess>
       <Path>C:\Windows\System32\taskkill.exe</Path>
       <Arguments>/IM GSW32.EXE /f</Arguments>
       <ApplicationId>N:\Lufkin Automation\SROD 6.0\SROD6.exe</ApplicationId>
      </ExitProcess>
     </UserScripts>

    Tuesday, February 2, 2016 11:17 PM
  • I'm not 100% sure, but I think the ApplicationID needs to be with the AppV tokens.
    Tuesday, February 2, 2016 11:27 PM
  • can you try changing the <ApplicationId> and check once.

    (Please click on Vote as Helpful and/or Mark as Answer, if it has helped you.)

    Wish to add MVP behind my name :)

    app2pack.blogspot.com: app2pack.blogspot.com

    Wednesday, February 3, 2016 7:56 AM
  • Honestly do not know what you mean by appv tokens.  I used the same applicationID's that are listed in the user config xml file under the   <Applications> section and nothing worked.  But that is ok, as I came up with another idea.

    Since I cannot figure out how to use exitprocess right I decided I can do that myself.  What I did this morning is change my application to nothing.exe (a tool I believe you can get from Tmurgent's website) and use my own launch script under UserScripts which will run the gsw32.exe program, then the real program and wait for the real program to close.  When the script continues past that it closes the gsw32.exe on it's own.  This is the kind of thing we had to do in some cases in app-v 4.6, usually because of that old issue where programs closed exactly 10 minutes after launching them.

    Thanks for you help anyway

    Bruce

    • Marked as answer by BSpies1 Wednesday, February 3, 2016 3:30 PM
    Wednesday, February 3, 2016 3:29 PM
  • BSpies1,

    What I meant by the 'applicationID' is this portion:

       <UserScripts>
      <StartVirtualEnvironment  RunInVirtualEnvironment="true">
       <Path>[{AppVPackageRoot}]\VFS\SystemX86\GSW32.EXE</Path>
       <Arguments></Arguments>
      </StartVirtualEnvironment>
      <ExitProcess>
       <Path>C:\Windows\System32\taskkill.exe</Path>
       <Arguments>/IM GSW32.EXE /f</Arguments>
       <ApplicationId>N:\Lufkin Automation\SROD 6.0\SROD6.exe</ApplicationId>
      </ExitProcess>
     </UserScripts>

    I think the AppV Service will only monitor within its path system.  Its path system uses tokens to identify the path.  In your posting above, this is a path done correctly with AppV tokens:

       <Path>[{AppVPackageRoot}]\VFS\SystemX86\GSW32.EXE</Path>

    I'm not sure what your actual token path is to SROD6.exe, but it should have a tokenized path, unless this is a separate executable that isn't in the AppV package.

    Wednesday, February 3, 2016 6:40 PM
  • ah ok, that makes sense.  Unfortunately the SROD6.exe is on our N: drive, a network drive where we run some applications from.  Maybe it cannot be token-ized then and therefore cannot be monitored by ExitProcess.

    thanks for the help and knowledge!

    Bruce

    Thursday, February 4, 2016 5:16 PM