i will use a custom exitcode 69107 but when i start the script with Invoke-AppDeployToolkit.exe the Package will always display a MSGBOX with a An error occurred while running Invoke-AppDeployToolkit.ps1. Exit Code: 69107 at the end of the installation.
If i run the script via powershell.exe and the ps1 directly the MSGBOX will not be displayed.
I don’t understand why, and how can i work around. I Use the Invoke-ServiceUI.PS1.
How can achieve that when i exit a script with a custom exit code but not classified as an error? But instead, for example, as a warning.
Looking at these lines in your log, it appears that the messaging that the user will see appears correctly during the Pre-Install section, but the script then exits before the actual application installer is executed.
Can you supply a snippet of your script showing what you are running in the Pre-Install, Install and Post-Install sections? - It feels like there is something not configured correctly (maybe something as simple as a missing quote or bracket )
function Install-ADTDeployment
{
##================================================
## MARK: Pre-Install
##================================================
$adtSession.InstallPhase = "Pre-$($adtSession.DeploymentType)"
## Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt.
Show-ADTInstallationWelcome -CloseProcesses iexplore -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt
## Show Progress Message (with the default message).
Show-ADTInstallationProgress
## <Perform Pre-Installation tasks here>
##================================================
## 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('Transform', $adtSession.DefaultMstFile)
}
Start-ADTMsiProcess @ExecuteDefaultMSISplat
if ($adtSession.DefaultMspFiles)
{
$adtSession.DefaultMspFiles | Start-ADTMsiProcess -Action Patch
}
}
## <Perform Installation tasks here>
Close-ADTSession -exitcode 69107
##================================================
## MARK: Post-Install
##================================================
$adtSession.InstallPhase = "Post-$($adtSession.DeploymentType)"
## <Perform Post-Installation tasks here>
## Display a message at the end of the install.
if (!$adtSession.UseDefaultMsi)
{
Show-ADTInstallationPrompt -Message 'You can customize text to appear at the end of an install or remove it completely for unattended installations.' -ButtonRightText 'OK' -Icon Information -NoWait
}
}
It’s only a testscript with the exitcode. Nothing will done with this script ;-). Based on fresh downloaded 4.0.6 Template. We use our scripts with the invoke-servicesui.ps1 and there the scripts will be started with the invoke-applikation.exe. Only than you see the msgbox i attached.
The second question: How can I declare my custom exit code so that it is not classified as an error?