Show-installationwelcome fails when no active users are logged on

i’m seeing issues when deploying software via sccm for system whether or not any users are logged on. our psadt template looks for any running processes that have to be closed and then we prompt the user with the option to defer. this is all great but lately we are seeing deployments fail when no user is present to be prompted when the processes are running.

here’s the code block

Set variable for processes to check for and show screen pop if processes are running to allow end users the chance to save work and close apps

    $RunningProcesses = "notepad"

    $Processes = $RunningProcesses.Split(",")

    If (Get-Process $Processes -ErrorAction SilentlyContinue) {

        If ($UsersLoggedOn) {

            # Save previous DeployMode

            $PreviousDeployMode = $DeployModeSilent

            $PreviousDeployMode2 = $DeployModeNonInteractive

            # Change DeployMode to interactive

            $DeployModeSilent = $False

            $DeployModeNonInteractive = $False

            # Show the installation welcome

            Show-InstallationWelcome -AllowDefer -DeferTimes 3 -CloseApps $RunningProcesses -ForceCloseAppsCountdown 60 -PersistPrompt

            # Restore saved DeployMode

            $DeployModeSilent = $PreviousdeployMode

            $DeployModeNonInteractive = $PreviousDeployMode2


        Else {

            Show-InstallationWelcome -CloseApps $RunningProcesses -Silent



it doesn’t seem to matter what i try if there’s not an active user logged in the app install fails when it tries to show the pop up for the runnning processes. how is anyone handling this?

You are over thinking the issue.
The PSADT authors already deal with users that may or may not be logged in.
This is all you need:

[String]$RunningProcesses = "notepad,paint"
Show-InstallationWelcome -AllowDefer -DeferTimes 3 -CloseApps $RunningProcesses -ForceCloseAppsCountdown 60 -PersistPrompt

the problem happens when the process is running and you need to kill it but there’s not a user logged for psadt to show the prompt to then the install fails attempting to show the form.

for example, a piece of software is required install via sccm and is a system install but we’d like to present a pop up if a user is logged in and they have a process that we need to kill off to install. this could happen in or out of the maint window. our environment could potentially have users working at any given hour and we don’t want to disrupt them without giving them a chance to finish up or possibly defer.

This is AUTOMATICALLY handled in PSADT.

You type this:

Show-InstallationWelcome -AllowDefer -DeferTimes 3 -CloseApps $RunningProcesses -ForceCloseAppsCountdown 60 -PersistPrompt

IF there is a user logged-on, they have 60 seconds to close the app.
If the user does not respond, the app is closed.

No user logged on? ==> No popup ==> the app is closed. AUTOMATICALLY

Don’t beleive me? Go look in AppDeployToolkitMain.ps1 for the Show-InstallationWelcome function

you’re not following. if we deploy the install as silent that pop up will never happen regardless. which is why we deploy as silent but then flip psadt to interactive if it finds the running process and then it should throw the prompt. it fails every single time if no user is logged on.

Is that the behaviour with the one line Show-InstallationWelcome command or with your block of code at the top?

with the online that you mention running psadt via sccm using deploy-application.exe install silent the prompt will never happen regardless. psadt will force close the apps and do the install. what i’m trying to accomplish:

deploy silent the same as always, IF a user is present and IF the conflicting process running present the show-installationwelcome screen. this is where my codeblock comes in. since sccm is installing as system if there’s no user present it’s not able to show the screen prompt and it doesn’t seem to care about the if ($usersLoggedOn) {} at all either.

I think your issue is with SCCM. This is from the PSADT PDF:

[In SCCM] On the User Experience page, ensure you use a combination of settings that allows the user to
interact with the application. Failure to do so will result in the application installing silently:


FYI: I don’t use the deploy-application.exe. popups work fine for me.
I set “Installation program visibility” to hidden to hide the powershell console.

Yeah. I’ve looked into that but I’m trying to avoid the “only when a user is logged in” and I don’t think there’s a clean way to handle this.

so do this:

So this is where I currently am and it’s not working.

don’t use the deploy-application.exe

I’ll give that a whirl. Won’t I run into issues with execution policy by doing this?

If you do while running as System, you have bigger problems.