UI issue of Show-ADTInstallationWelcome in 4.1.8

Dear Toolkit Experts,

UI of Show-ADTInstallationWelcome has some issue on the SCCM/Intune.

this is the correct one on the local test without issue using Invoke-AppDeployToolkit.exe

but it can't be displayed correctly when it deployed on the SCCM/Intune with command Invoke-AppDeployToolkit.exe, even I tried ServiceUI.exe.

Do you have any idea ? thank you in advance!

the issue one is:

There are a number of questions your post raises...
You appear to state something does not work when it is deployed with SCCM or Intune
Can you explain 'what' doesn't work?
Can you explain how you are doing your local test, this could include:

  • Which user are you using?
  • Is this user an Admin?
  • Are you using PSEXEC to launch as SYSTEM?

How are you deploying this from Intune / SCCM? (In the Users context or as SYSTEM?)
What is your SCCM or Intune deployment install command line?
It should be something like this:

Invoke-AppDeployToolkit.exe -DeploymentType Install

See this for more guidance:

Let us know and we may be able to advise further

Can you explain 'what' doesn't work?
UI can't be displayed correctly with SYSTEM

Can you explain how you are doing your local test, this could include:

  • Which user are you using? AD account
  • Is this user an Admin? Yes
  • Are you using PSEXEC to launch as SYSTEM? No

How are you deploying this from Intune / SCCM? (In the Users context or as SYSTEM?)
SYSTEM

What is your SCCM or Intune deployment install command line?
Invoke-AppDeployToolkit.exe -DeploymentType Install

By the looks of things your Invoke-AppDeployToolkit.ps1 script may have some settings defined incorrectly
As these two highlighted sections should agree


Also, it looks like you are changing the text between the dialogs per Deferral:
3 Deferrals "Postponements" remaining:

2 Deferrals remaining:

1 Deferral remaining:

Please can you reply with the code you have within the $adtsession = @ { (approx. line 89) and the closing } (approx line 113) and separately the contents of the Pre-Install and Install sections
Starting:

    ##================================================
    ## MARK: Pre-Install
    ##================================================

and ending above

    ##================================================
    ## MARK: Post-Install
    ##================================================

Remember to use the Pre-formatted text button on the toolbar (</>) to post each of your code blocks, as it makes is easier for all to read.

As a further question

Can you explain 'what' doesn't work?
UI can't be displayed correctly with SYSTEM

Can you explain what you expect to see that you are not seeing?

$adtSession = @{
    # App variables.
    AppVendor = ''
    AppName = 'Beyond Compare'
    AppVersion = '4.4.7.28397'
    AppArch = '64'
    AppLang = 'EN'
    AppRevision = '01'
    AppSuccessExitCodes = @(0)
    AppRebootExitCodes = @(1641, 3010)
    AppProcessesToClose = @()  # Example: @('excel', @{ Name = 'winword'; Description = 'Microsoft Word' })
    AppScriptVersion = '1.0.0'
    AppScriptDate = '2026-03-17'
    AppScriptAuthor = 'Ryan Gu'
    RequireAdmin = $true

    # Install Titles (Only set here to override defaults set by the toolkit).
    InstallName = ''
    InstallTitle = 'Software Update – Beyond Compare'

    # Script variables.
    DeployAppScriptFriendlyName = $MyInvocation.MyCommand.Name
    DeployAppScriptParameters = $PSBoundParameters
    DeployAppScriptVersion = '4.1.8'
}

function Install-ADTDeployment
{
    [CmdletBinding()]
    param
    (
    )

    ##================================================
    ## MARK: Pre-Install
    ##================================================
    $adtSession.InstallPhase = "Pre-$($adtSession.DeploymentType)"

    ## Show Welcome Message, close processes if specified, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt.
    #$saiwParams = @{
       # AllowDefer = $true
       # DeferTimes = 3
       # CheckDiskSpace = $true
       # PersistPrompt = $true
    #}
    if ($adtSession.AppProcessesToClose.Count -gt 0)
    {
        $saiwParams.Add('CloseProcesses', $adtSession.AppProcessesToClose)
    }
    #Show-ADTInstallationWelcome -CloseProcesses @{ Name = 'winword' }, @{ Name = 'excel' } -BlockExecution -AllowDefer -DeferTimes 1000 -CloseProcessesCountdown 600

    ## Show Progress Message (with the default message).
    #Show-ADTInstallationProgress

    ## <Perform Pre-Installation tasks here>
    #Check the version. If the latest version has already been installed or the software does not exist on the computer, exit the installation.
    $targetVersion = '4.4.7.28397'
    $currentVersion = Find-InstallKey -DisplayName $adtSession.AppName -DisplayVersion

    # Check if it is installed
    if ([string]::IsNullOrEmpty($currentVersion)) {
        Write-ADTLogEntry -Message "No version is installed. No update is required. Exit installation. Code: 0"
        Close-ADTSession -ExitCode 0
    }

    #check version
    $comparisonResult = Compare-Version -versionA $currentVersion -versionB $targetVersion
    if ($comparisonResult -eq 0) {
        Write-ADTLogEntry -Message "The target version has been installed. Exiting the installation. Code: 0"
        Close-ADTSession -ExitCode 0
    }
    elseif ($comparisonResult -eq 1) {
        Write-ADTLogEntry -Message "A higher version has been installed. Code: 0"
        Close-ADTSession -ExitCode 0
    }
    else {
        Write-ADTLogEntry -Message "The target version is not installed. Preparing to install."
    }

    ##================================================
    ## MARK: Install
    ##================================================
    $adtSession.InstallPhase = $adtSession.DeploymentType

    ## Handle Zero-Config MSI installations.
    if ($adtSession.UseDefaultMsi)
    {
        $ExecuteDefaultMSISplat = @{ Action = $adtSession.DeploymentType; FilePath = $adtSession.DefaultMsiFile }
        if ($adtSession.DefaultMstFile)
        {
            $ExecuteDefaultMSISplat.Add('Transforms', $adtSession.DefaultMstFile)
        }
        Start-ADTMsiProcess @ExecuteDefaultMSISplat
        if ($adtSession.DefaultMspFiles)
        {
            $adtSession.DefaultMspFiles | Start-ADTMsiProcess -Action Patch
        }
    }

    ## <Perform Installation tasks here>
    #Check if there are any processes of Graphviz
    $targetProcesses = @(
        "BCompare"
    )

    # target processes are currently running or not
    $runningProcesses = Get-Process -Name $targetProcesses -ErrorAction SilentlyContinue
    if ($runningProcesses) {
        #Prompt the user to close the software
        Show-ADTInstallationWelcome -CloseProcesses @{ Name = 'BCompare'} -BlockExecution -AllowDefer -DeferTimes 999 -CloseProcessesCountdown 600 -CustomText
        Show-ADTInstallationProgress
        Start-ADTProcess -FilePath 'BCompare-4.4.7.28397.exe' -ArgumentList '/SP- /VERYSILENT /NORESTART' -Timeout (New-TimeSpan -Minutes 10)
        $newVersion = Find-InstallKey -DisplayName $adtSession.AppName -DisplayVersion
        $comparisonResult = Compare-Version -versionA $newVersion -versionB $targetVersion
        if ($comparisonResult -eq 0) {
            Write-ADTLogEntry -Message "Installation has been successfully completed. Code: 0"
                    Close-ADTSession -ExitCode 0
        }
        else {
             Write-ADTLogEntry -Message "opps failed"
             Close-ADTSession -ExitCode 69444
        }
    }
    else {
        #start install
        Start-ADTProcess -FilePath 'BCompare-4.4.7.28397.exe' -ArgumentList '/SP- /VERYSILENT /NORESTART' -Timeout (New-TimeSpan -Minutes 10)
        $newVersion = Find-InstallKey -DisplayName $adtSession.AppName -DisplayVersion
        $comparisonResult = Compare-Version -versionA $newVersion -versionB $targetVersion
        if ($comparisonResult -eq 0) {
            Write-ADTLogEntry -Message "Installation has been successfully completed. Code: 0"
            Close-ADTSession -ExitCode 0
        }
        else {
            Write-ADTLogEntry -Message "opps failed"
            Close-ADTSession -ExitCode 69444
        }
    }

Thank you Scott !

I need this content as below, but some UI will be lost with SYSTEM account.e.g. process detection, and “Dear User” will become The original message....

the incorrect one with SYSTEM:

In the $adtSession = @{ variables you don't have any app Processes to close defined

I'd suggest you either have this:
AppProcessesToClose = @('bcompare')
or more elegant to the user:
AppProcessesToClose = @(@{ Name = 'bcompare'; Description = 'Scooter Software Beyond Compare'})

Then in the Pre-Install section modify with this:

 ## Show Welcome Message, close Beyond Compare, allow up to 3 deferrals, verify there is enough disk space to complete the install, persist the prompt and Block Excel being relaunched until complete.
    $saiwParams = @{
        AllowDeferCloseProcesses = $true
        DeferTimes = 3
        CheckDiskSpace = $true
        PersistPrompt = $true
        # BlockExecution = $true # Optional - Allows you to block the launch of Beyond Compare during the install
    }
    if ($adtSession.AppProcessesToClose.Count -gt 0)
    {
        $saiwParams.Add('CloseProcesses', $adtSession.AppProcessesToClose)
    }
    Show-ADTInstallationWelcome @saiwParams

    ## Show Progress Message (with the default message).
    Show-ADTInstallationProgress

It looks like you are reinventing the wheel.
By using PSADT's native process detection, this whole section is not required:

 #Check if there are any processes of Graphviz
    $targetProcesses = @(
        "BCompare"
    )

    # target processes are currently running or not
    $runningProcesses = Get-Process -Name $targetProcesses -ErrorAction SilentlyContinue
    if ($runningProcesses) {
        #Prompt the user to close the software
        Show-ADTInstallationWelcome -CloseProcesses @{ Name = 'BCompare'} -BlockExecution -AllowDefer -DeferTimes 999 -CloseProcessesCountdown 600 -CustomText
        Show-ADTInstallationProgress

and this (at the end of your code block) is not required either:

}
    else {
        #start install
        Start-ADTProcess -FilePath 'BCompare-4.4.7.28397.exe' -ArgumentList '/SP- /VERYSILENT /NORESTART' -Timeout (New-TimeSpan -Minutes 10)
        $newVersion = Find-InstallKey -DisplayName $adtSession.AppName -DisplayVersion
        $comparisonResult = Compare-Version -versionA $newVersion -versionB $targetVersion
        if ($comparisonResult -eq 0) {
            Write-ADTLogEntry -Message "Installation has been successfully completed. Code: 0"
            Close-ADTSession -ExitCode 0
        }
        else {
            Write-ADTLogEntry -Message "opps failed"
            Close-ADTSession -ExitCode 69444
        }
    }

You then need to move some of the lines in your Install Section into the Pre-Install section

I notice you are probably over complicating this as you have built in some version detection into your script.
What deployment platform are you using to push this to your users?
If using Intune or SCCM the detection should occur before (and after) the install process, so if the device already has the latest version, the install is not triggered making the detection within your script unnecessary

p.s. my name is Adrian

One suggestion I'd make is have a look at some of the PSADT v4 install examples on Silent Install HQ as they give some good examples of how to achieve some of what you are aiming at.
this one for example:

N.B. In the above example the OS Architecture detection is not strictly required and neither is the Uninstall of the earlier version prior to the install, but hopefully this gives you some guidance

What I imagine is happening is that Beyond Compare is not running as the user that our client/server process is running as. I'll frame the scenario.

  1. You're logged onto your Windows client using a daily driver account.
  2. You've opened Beyond Compare using an alternative set of credentials.
  3. You've started our product via SYSTEM, which runs our UI via your daily driver account.
  4. Daily driver account is not administrative, therefore cannot see other user's processes.

Does any of this sound like what's going on? If so, it's expected behaviour as users don't have authority to see other people's processes, yet alone close them.

Hello Adrian, Thank you for your guidance !

Hello Sir,

You are right !

You reminded me that indeed when I was re-running the test code, I would run the BCompare using another administrator account, and then problems would arise.

I don't have problem now, thank you !

I'm glad we got to the bottom of it! When we get onto [Feature] Improve client/server experience on multi-session operating systems (terminal services, AVD, etc). · Issue #1536 · PSAppDeployToolkit/PSAppDeployToolkit · GitHub, this won't be an issue anymore as we'll move the process management code so that it's server-side again.