win_domain reboot required exception incorrectly reported (#60496)

* Set reboot required dependent on exception message.

* Use exception id instead of it's message
This commit is contained in:
Klaus Frank 2019-08-18 22:05:33 +02:00 committed by Jordan Borean
parent 0d88ec241f
commit cc5957001c

View file

@ -124,10 +124,10 @@ if (-not $forest) {
} catch [Microsoft.DirectoryServices.Deployment.DCPromoExecutionException] {
# ExitCode 15 == 'Role change is in progress or this computer needs to be restarted.'
# DCPromo exit codes details can be found at https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/deploy/troubleshooting-domain-controller-deployment
if ($_.Exception.ExitCode -eq 15) {
if ($_.Exception.ExitCode -in @(15, 19)) {
$result.reboot_required = $true
} else {
Fail-Json -obj $result -message "Failed to install ADDSForest with DCPromo: $($_.Exception.Message)"
Fail-Json -obj $result -message "Failed to install ADDSForest, DCPromo exited with $($_.Exception.ExitCode): $($_.Exception.Message)"
}
}