I recently packaged an application that, upon launch, started a process which spawned a child process.  The child process remained running after the parent process was closed, and this caused an issue when unpublishing the App-V 5 package.  This blog will discuss App-V 5 and terminate child process.

EntDistributorService.exe was the parent process and hvced.exe was the child process.  I knew hvced.exe was a child process by running the wmic command found here.  But when a process contained within the App-V package remains open, it presents issues when we need to unpublish it – the App-V package can’t be unpublished if it is still deemed as being in a ‘running’ state!  So a reboot is usually required.

I tried to kill hvced.exe using a script (I tried taskkill.exe and Powershell’s Stop-Process) which ran in the ExitProcess scripting phase of EntDistributorService.exe in the UserConfig.xml.  Unfortunately the context that UserConfig scripts run in didn’t have enough permissions to kill the process, since EntDistributorService.exe was launched in a SYSTEM context and as a result hvced.exe was also running in a SYSTEM context.

After all this fiddling around, it turned out that the solution was quite simple really.  In the DeploymentConfig.xml file we can simply add the parent file who’s child processes we want to terminate like so:

<TerminateChildProcesses>      
    <Application Path="[{AppVPackageRoot}]\VFS\ProgramFilesCommonX86\HealthVISION\EntDistributorService.exe" />         
</TerminateChildProcesses>

This tells App-V that whenever the EntDistributorService.exe process is stopped, to kill any child processes that remain open.  Hopefully this example will clarify App-V 5 and terminate child process feature.

App-V 5 and Terminate Child Process
Comments have now been disabled. If you have a question to ask about this post please ask the community!