Fix the reboot_required return value (#28579)

As reported in #28565
pull/24831/merge
Dag Wieers 7 years ago committed by Jordan Borean
parent d8429a69c5
commit d830186e27

@ -235,6 +235,9 @@ Try {
} }
$join_result = Join-Domain @join_args $join_result = Join-Domain @join_args
# this change requires a reboot
$result.reboot_required = $true
} }
ElseIf(-not $hostname_match) { # domain matches but hostname doesn't, just do a rename ElseIf(-not $hostname_match) { # domain matches but hostname doesn't, just do a rename
Write-DebugLog ("domain matches, setting hostname to {0}" -f $hostname) Write-DebugLog ("domain matches, setting hostname to {0}" -f $hostname)
@ -247,10 +250,13 @@ Try {
} }
$rename_result = Rename-Computer @rename_args $rename_result = Rename-Computer @rename_args
}
# all these changes require a reboot # this change requires a reboot
$result.reboot_required = $true $result.reboot_required = $true
} Else {
# no change is needed
}
} }
Else { Else {
Write-DebugLog "check mode, exiting early..." Write-DebugLog "check mode, exiting early..."
@ -267,11 +273,15 @@ Try {
If(-not $workgroup_match) { If(-not $workgroup_match) {
Write-DebugLog ("setting workgroup to {0}" -f $workgroup_name) Write-DebugLog ("setting workgroup to {0}" -f $workgroup_name)
$join_wg_result = Join-Workgroup -workgroup_name $workgroup_name -domain_admin_user $domain_admin_user -domain_admin_password $domain_admin_password $join_wg_result = Join-Workgroup -workgroup_name $workgroup_name -domain_admin_user $domain_admin_user -domain_admin_password $domain_admin_password
# this change requires a reboot
$result.reboot_required = $true $result.reboot_required = $true
} }
If(-not $hostname_match) { If(-not $hostname_match) {
Write-DebugLog ("setting hostname to {0}" -f $hostname) Write-DebugLog ("setting hostname to {0}" -f $hostname)
$rename_result = Rename-Computer -NewName $hostname $rename_result = Rename-Computer -NewName $hostname
# this change requires a reboot
$result.reboot_required = $true $result.reboot_required = $true
} }
} }

Loading…
Cancel
Save