-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Summary of the new feature / enhancement
You would normally want 3010 exit codes to be reported to the deployment system so that they can advise the user a reboot is required. This is fine since those requests can be ignored and acted upon later.
However a task sequence reboots instantly when it gets a 3010 from an application install.
It's not possible to change the SuppressRebootPassThru property of the session after it's been opened, nor is there a public command for determining if we're in a TS that we can use to work out if SuppressRebootPassThru should be enabled before opening the session.
Proposed technical implementation details (optional)
So one way to make this easier would be to change this to a read/write property. This would still need some custom code in the template to achieve the desired outcome, so it would be nicer still if there was a dedicated switch for it, either by making SuppressRebootPassThru an enum to support a 3rd option, or a new switch e.g. -SuppressRebootPassThruInTaskSequence.
For now, one way of achieving this is to place this code before Exit-ADTSession in the current template:
if ($RunningTaskSequence -and $adtSession.GetExitCode() -eq '3010')
{
Write-ADTLogEntry -Message 'Supressing reboot due to running task sequence.'
$adtSession.SetExitCode(0)
}You could also modify the template to set SuppressRebootPassThru dependent on if we are in a TS (this is the method PSADT uses to set the $RunningTaskSequence variable):
SuppressRebootPassThru = (!![System.Type]::GetTypeFromProgID('Microsoft.SMS.TSEnvironment'))