Handling exit codes to cause Reboots

I wanted to ask you how you deal with exit codes.
I am currently building an allrounder PSADT template and exit codes already play a big role.
The idea is that the PSADT handles the exitcodes and not the distribution system behind it like intune.

I thought to catch the exitcodes with the -passthru parameter and then query them in an if loop. this could be done for example in the installation section.
But because the PSADT is a complete try-catch function, you can build the whole thing at the end ?
so instead of:

maybe something like this
please note that i haven’t tested the whole thing yet and this is just a thought process i had at the end of the working day :smiley:

I would be happy if you tell me your thoughts^^

To each their own.

I would have a small delay on the reboot like this:

$mainExitCode = $appExitCode
Show-InstallationRestartPrompt -Countdownseconds 11 -CountdownNoHideSeconds 10 -NoSilentRestart $false

This way Intune has a chance to get an exitcode it so desires.

1 Like