Toolkit keeps returning exit code 0 instead of 3010.

Topics: Archive - General
Jul 14, 2014 at 6:20 AM
After an installation I try to return a 3010 code back to ConfigMgr to restart the machine.
I use the Exit-Script function as following:
Exit-Script -ExitCode "3010"
I am aware that the $AllowRebootPassThru variable needs to be TRUE to avoid the suppression of this exit code. However PSAppDeploy Toolkit keeps returning return code 0 when I call the script with -AllowRebootPassThru.
When I replace 3010 with any other code it gets returned correct.

Do I need to configure something else to return a 3010 code?
Jul 14, 2014 at 6:28 AM
Looked at the AppDeployToolkitMain.ps1 and found the reason.
If ($msiRebootDetected -eq $true -and $AllowRebootPassThru -eq $true) {
The MSI does not return a restart code and therefore the $msiRebootDetected variable is set to false. It works when I manually set it to true.
The documentation is not very clear on this behavior. It only mentions that
If $AllowRebootPassThru is set to False, it will suppress any "3010" exit codes detected during the installation and instead pass the "0" exit code.
Coordinator
Jul 15, 2014 at 9:26 PM
Hi,

If the application installation itself does not return a 3010 code it might be best to configure the restart behaviour of the application in :

http://www.petervanderwoude.nl/post/working-with-the-restart-behavior-of-applications-in-configmgr-2012/

Regards,
Sean