Show-ADTInstallationPrompt and v4

I see that v4.1.0 is likely going to make this question deprecated soon, but I was hoping to get one app packaged to use the Installation Prompts in Intune where the app installs in the SYSTEM context. I believe I am on the right track in needing ServiceUI, so I loaded those in:

This app is for GlobalProtect, and we currently have it set up so that GlobalProtect doesn’t connect while the user is in office. I was hoping to set this up to skip the prompts when this is the case by running an IF statement near the top of the Invoke-ServiceUI.ps1:

param (
    [string[]]$ProcessName = @('explorer'),
    [ValidateSet('Install', 'Uninstall', 'Repair')]
    [string]$DeploymentType = 'Install',
    [switch]$AllowRebootPassThru,
    [switch]$TerminalServerMode,
    [switch]$DisableLogging
)

# Check the status of the PANGP Virtual Ethernet Adapter
$AdapterStatus = (Get-NetAdapter | Where-Object { $_.InterfaceDescription -like "PANGP Virtual Ethernet Adapter*" }).Status

if ($AdapterStatus -eq 'Up') {
    # Adapter is connected, proceed with the existing logic
    Push-Location $PSScriptRoot

    if ($env:PROCESSOR_ARCHITECTURE -eq 'AMD64' -or $env:PROCESSOR_ARCHITEW6432 -eq 'AMD64') {
        $Architecture = 'x64'
    } else {
        $Architecture = 'x86'
    }

    if (Get-Process -Name $ProcessName -ErrorAction SilentlyContinue) {
        if ([Environment]::UserInteractive) {
            # Start-Process is used here otherwise script does not wait for completion
            $Process = Start-Process -FilePath '.\Invoke-AppDeployToolkit.exe' -ArgumentList "-DeploymentType $DeploymentType -DeployMode Interactive -AllowRebootPassThru:`$$AllowRebootPassThru -TerminalServerMode:`$$TerminalServerMode -DisableLogging:`$$DisableLogging" -NoNewWindow -Wait -PassThru
            $ExitCode = $Process.ExitCode
        } else {
            # Using Start-Process with ServiceUI results in Error Code 5 (Access Denied)
            &".\ServiceUI_$Architecture.exe" -process:explorer.exe Invoke-AppDeployToolkit.exe -DeploymentType $DeploymentType -DeployMode Interactive -AllowRebootPassThru:"`$$AllowRebootPassThru" -TerminalServerMode:"`$$TerminalServerMode" -DisableLogging:"`$$DisableLogging"
            $ExitCode = $LastExitCode
        }
    } else {
        $Process = Start-Process -FilePath '.\Invoke-AppDeployToolkit.exe' -ArgumentList "-DeploymentType $DeploymentType -DeployMode Silent -AllowRebootPassThru:`$$AllowRebootPassThru -TerminalServerMode:`$$TerminalServerMode -DisableLogging:`$$DisableLogging" -NoNewWindow -Wait -PassThru
        $ExitCode = $Process.ExitCode
    }

    Pop-Location
} else {
    # Adapter is disconnected, run silent installation and exit
    $Process = Start-Process -FilePath '.\Invoke-AppDeployToolkit.exe' -ArgumentList "-DeploymentType $DeploymentType -DeployMode Silent -AllowRebootPassThru:`$$AllowRebootPassThru -TerminalServerMode:`$$TerminalServerMode -DisableLogging:`$$DisableLogging" -NoNewWindow -Wait -PassThru
    $ExitCode = $Process.ExitCode
}

exit $ExitCode

I might have this thinking wrong by putting it in the ServiceUI.ps1, but I figured that it would just install without the prompts. Basically, if the NetworkAdapter status shows as “Up”, push the prompts so that it warns the user and lets them hit the Update button in the Show-ADTInstallationPrompt.

I have my Pre-Install section set up like this:

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

    Show-ADTInstallationPrompt -Message "We require your GlobalProtect VPN software to be updated. When ready, please hit the Update button to start. It should take 1-2mins to complete and come back up for you to re-connect." -ButtonMiddleText 'Ok'

    Show-ADTInstallationProgress

 # Uninstall previous version of Globalprotect
 Uninstall-ADTApplication -Name 'GlobalProtect' -FilterScript {$_.Publisher -eq 'Palo Alto Networks'}

and, my for my install command in Intune, I pulled it from the example, since I didn’t change the names of the files:


%SystemRoot%\System32\WindowsPowerShell\v1.0\PowerShell.exe -ExecutionPolicy Bypass -NoProfile -File Invoke-ServiceUI.ps1 -DeploymentType Install -AllowRebootPassThru

I feel like it is close, but unfortunately, PSADT installs fine through testing in Powershell and shows the prompts in testing, but once I bump over to Intune and use the SYSTEM context, it installs but drops the prompts. Now, it is just failing to install, so I believe it to be an issue with either the install command or the Invoke-ServiceUI.ps1 changes that I made. It just just a pain to package and upload to Intune and find that it is failing to install. I am likely going to put another IF statement in that skips ServiceUI, if the environment is ARM64, since I have that working in my main PSADT file, but I don’t want to just add onto this mess until I have a better idea of what is breaking my install.

Not sure if the below is you, but ultimately you’re correct in that 4.1.0 is going to solve the issue entirely/properly.

We have tested the AMD64 version of ServiceUI on ARM64 devices and it does work fine. The biggest issue with ServiceUI is that quoted arguments on the command line need escaping in a certain way otherwise its not happy.

1 Like

No, that wasn’t me, but it looks like I am in the same boat in just needing to push out a quick update that I want to warn the user about.

So, what you’re saying is that my issue might just be this part?

Show-ADTInstallationPrompt -Message "We require your GlobalProtect VPN software to be updated. When ready, please hit the Update button to start. It should take 1-2mins to complete and come back up for you to re-connect."

I am guessing it needs to look more like:

Show-ADTInstallationPrompt -Message `"We require your GlobalProtect VPN software to be updated. When ready, please hit the Update button to start. It should take 1-2mins to complete and come back up for you to re-connect.`"

If that is all it was, I am going to be kicking myself.. I swear, sometimes I really get the `" vs " vs ’ , and others times I feel like an idiot haha