Is there a way to only display the ShowInstallationWelcome only when the specified apps are opened?

Is there a way to only display the ShowInstallationWelcome only when the specified apps are opened? And when no apps are opened, it just installs silently?

Yes through an If statement.

if (get-process -name "explorer" -erroraction silentlycontinue) {
    # save previous deploymode
    $previousdeploymode = $deployModeSilent
    $previousdeploymode2 = $deployModeNonInteractive
    # change deploy mode to interactive
    $deployModeSilent = $false
    $deployModeNonInteractive = $false
    # show the installation welcome
    ShowInstallationWelcome -CloseApps 'explorer'
    # restore saved deploymode
    $deployModeSilent = $previousdeploymode
    $deployModeNonInteractive = $previousdeploymode2
}
2 Likes

-AllowDeferCloseApps []
Enables an optional defer button to allow the user to defer the installation only if there are running applications that need to be closed.

But if PSADT is running in a process that isnt interactive, it will kill all the processes that is listed (without notice!).
Show-InstallationWelcome should have $TestIfRunningOnly switch · Issue #202 · PSAppDeployToolkit/PSAppDeployToolkit (github.com)