InstallationRestartPrompt and ExitCode


I have a problem.
In the “Pre-Installation” I need something to do and after that it must be a reboot. For that I use the “Show_InstallationRestartPrompt” and want to give an exit code back to SCCM.

This part looks like that:

$AllowRebootPassThru = $True
Show-InstallationRestartPrompt -NoCountdown
exit-script -exitcode &quot;1641&quot;

Now, the “Show_InstallationRestartPrompt” closes the Installation dialog and completed with exit code 0…

[Pre-Installation] :: Invoking Show-InstallationRestartPrompt asynchronously with no countdown...	Show-InstallationRestartPrompt	16.03.2016 10:51:24	448 (0x01C0)
[Pre-Installation] :: Close the installation progress dialog.	Close-InstallationProgress	16.03.2016 10:51:24	448 (0x01C0)
[Pre-Installation] :: Microsoft_AppVExcel2016_16.0.6366.2036_x64_EN_01 Installation completed with exit code [0].	Exit-Script	16.03.2016 10:51:24	448 (0x01C0)
[Pre-Installation] :: -------------------------------------------------------------------------------	Exit-Script	16.03.2016 10:51:24	448 (0x01C0)

So SCCM thinks everything is ok and runs the detection method and fail, while the user get the window for restart.
After the restart, the failed app can be retried and it works, but its no so smooth like it should be :wink:

what can/should I do here?

Sounds like you’re installing prereqs in the same application / deployment type as your “main application”. If you want nice and tidy deployments and smooth user experience, you should set up each prereq as it’s own application / deployment type and use Dependencies on your main DT.

Depending on your client settings It might (most likely will) result in longer deployment time so it’s up to you. Perhaps you can wrap all prereqs in one package, but I’d prefer to have them all separate. This way you can lean back knowing that the prereqs definitely are installed if the deployment of your main application says it is installed. That is if all your detection methods are properly set up of course.

Also if separated, they can be re-used as dependencies for other applications as needed, hence saves you time. I have to say I do both myself though depending on the situation. But sounds like you have a case where it’s reasonable to set up one or more prereqs as its own independent application.