Start a exe then shut down

Hi Guys

Im really new to PSDT so im not sure how to accomplish this, What I need to do is after installing a MSI I need to start the application so it creates a file in %username%\appdata then overwite the file created . The issue i have is closing the app after i open it. This is what i have is there a command to exit the app? Im having a hard time finding

        Execute-Process -Path 'C:\Program Files (x86)\Ontario Systems\Artiva Webstation\Webstation.Client.exe'

        Start-Sleep -Seconds 5

     ## here is where I want to close the exe
        
        Remove-File -Path "$envAppData\Ontario Systems\Webstation\Webstation.Client.config"

        Copy-File -Path "$scriptDirectory\Files\User config\*.*"  -Destination "$envAppData\Ontario Systems\Webstation"

Thank you for you time!

Execute-Process -Path 'C:\Program Files (x86)\Ontario Systems\Artiva Webstation\Webstation.Client.exe'

Start-Sleep -Seconds 5   #This is not a good idea (BTW) you cannot be sure the setup is complete.

## here is where I want to close the exe
Show-InstallationWelcome -CloseApps 'Webstation.Client' -silent  #FYI: I'm guessing on the app name 
        
Remove-File -Path "$envAppData\Ontario Systems\Webstation\Webstation.Client.config"

Copy-File -Path "$DirFiles\User config\*.*"  -Destination "$envAppData\Ontario Systems\Webstation"  #this is also a bad idea if you use SCCM to deploy.

Try copying the files into the profile BEFORE you run Webstation.Client.exe
If it works, consider using Active-setup to copy those files into the user’s profile.

I cant copy first the app has to open before the folder is created . It openbs creates the file but then I have to overlay that file

I tried this after the MSI install but message doesnt popup

[string]$appCloseApps = ‘Webstation.Client’
Show-InstallationWelcome -CloseApps $appCloseApps -CloseAppsCountdown 3 -CheckDiskSpace -PersistPrompt

Are you using SCCM to launch?

Not yet running locally … I make sure it works first than deploy w/ SCCM

Since we are doing this blind (no logging), I’m guessing (no logging) the reason Show-InstallationWelcome -CloseApps didn’t show anything is because Webstation.Client is not what is needs to be looking for. Use Get-Process to get the right name.

I did that and put the correct process name . Same result. Its ok ill try and figure something else out. Thanks for your time sir

Hi,
Why you don’t check real application name in Task Manager?
If Show-InstallationWelcome -CloseApps doesn’t kill the APP you have to use native get-process -name “name of the process to kill” | Stop-Process
The think is here process name which must be different from Webstation.Client

Cheers
JD

Hey

I did check and that was the name. But its OK now I just did a new-folder to pre-create the folder needed so I am good now thanks…