Error dialog box stopping Toolkit 4.x process from continuing

Hi guys,

I have a question regarding error handling in the new PSADT 4.x.
My experience is that the toolkit displays an error message and the process does not continue/close:

This is a big problem as we do not want to present such error message to the user and because of the process not coming to an end until the message is closed.

Our expectation would be that the process ends with the error exit code (60001 in the example) so that the software distribution system can correctly report and handle the error.
Otherwise the process will end in a timeout if the user does not react.

We already changed the Invoke-AppDeployToolkit.ps1 to prevent the extensive error message but did not find a way to do this with the short termination message:

catch
{
    Write-ADTLogEntry -Message ($mainErrorMessage = Resolve-ADTErrorRecord -ErrorRecord $_) -Severity 3
    #Show-ADTDialogBox -Text $mainErrorMessage -Icon Stop | Out-Null
    Close-ADTSession -ExitCode 60001
}

Is there a way to always prevent this message box and just end the process?

Thank you and kind regards

The executable is being reworked to prevent these popups from appearing, you should see an improvement in the next release.

The specific prompt that @DanGough has mentioned has been reworked in our development branch for 4.1.0. The backstory here is that people would run the exe, get some kind of silent failure, and never think once to run their script directly via powershell.exe. We added the prompt to try and address this, but it caused more problems than it solved.

The way we’ve addressed this now for the upcoming 4.1.0 release is that you can run the .exe with a /Debug switch and it will open up a console so you can see what’s going on. An example of this is below:

This restores the expected 3.x behaviour, while giving endless debug power with the correct argument. The exe will still give an on-screen dialog for major problems, such as missing files/folders needed to invoke the script.