Toolkit keeps returning exit code 0 instead of 3010.

Topics: Archive - General
Jul 14, 2014 at 7: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 7: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.
Jul 15, 2014 at 10:26 PM

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