Application installation issues via PS script

I am trying to install a package using a PS script through SCCM. The application installs fine but during the installation, the application is launched. The SCCM job will not complete until the application is closed. I want to be able to add some code to my script to shut the application down after installing, so SCCM will show success.

Currently I just have:

start-process -FilePath ‘xxxxx.exe’ -wait

if (get-process ‘xxxx.exe’){
stop-process ‘xxxx.exe’
}

It’s a simple install.

I was able to do something like this and have it work:

Start-Process -FilePath "C:\Program Files\Mozilla Firefox\firefox.exe"

Needed to let firefox run before closing

Start-Sleep -Seconds 5

if (Get-Process -ProcessName ‘firefox’) {

Stop-Process -ProcessName 'firefox'

}


I think if you reference the actual name of the process with Get-Process and Stop-Process, rather than “name.exe”, it should work a bit better for you. Hope that helps!

You should contact the vendor / manufacturer of the software. That’s not a common behaviour for an installation process.