-CloseApps when processes have the same name

I want to deploy “Git for Windows” updates which requires the bash.exe from “C:\Program Files\Git\usr\bin” to be closed. But some users use other bash terminals that are also just called “bash.exe” that could stay open, but naturally PSADT wants it closed too because it doesn’t know the difference.
Is there a way to make this work? I can let the setup .exe kill the correct process itself with /CLOSEAPPS but I am 100% sure that someone will complain then… :slight_smile:

Hello, I’m in the process of changing a little the show-installationwellcome in order to also accept full exe path but still havent had the time.
I will keep you updated as soon as I finish.
PS - Anyone else can also help of couse :smiley:


Hi @RaulCosta I think that modification would be quite a useful addition for a number of us, to ensure the correct app (by path) is prompted / closed

1 Like

We need to implement something like this.

	        $PathExeX86 = "c:\programfiles\an app\bin\jre\bin\javaw.exe"
	        if (Test-Path $PathExeX86)
	            $GetRunningProcess = Get-Process | Where-Object {$_.Path -like "$PathExeX86"}
	            if($GetRunningProcess -eq $null)
                        $deployModeSilent = $true 
			            Write-Log "Java is not running." -Severity 2 -Source "PSAppDeployToolkit"
                        Show-InstallationWelcome -AllowDefer -DeferDays $iDeferMaxNumberDays -MinimizeWindows $false -TopMost $true -CloseAppsCountdown $iCloseAppsCountDown 
			            Write-Log "Java version is running. It will close now." -Severity 2 -Source "PSAppDeployToolkit"
			            $GetRunningProcess | Stop-Process -Force
			            Write-Log "Java has been closed."

I think if you replaced:


$GetRunningProcess = (Get-Process).Path | Where-Object {$_ -like "$PathExeX86"}

It would work better