$InputObject.RebootRequested

$InputObject.RebootRequested

Description

If a package requires a reboot, it cannot reboot immediately because the package would not finish, and the result would never be successful. If an asynchronous delay is added before rebooting to allow the package to finish and report success to the backend, the agent might start the next package while the computer is rebooting, which breaks the next package.

You want the package to finish and deliver the result cleanly, without setting the agent state to ‘Ready’, as that signals the backend to start the next package.

Setting the RebootRequested property achieves this. After the package completes and reports the result, the agent (PackageInstaller module) waits up to 45 minutes before signaling ‘Ready’ to the backend. This asynchronous pause halts the PackageInstaller module while the rest of the agent runs normally.

During the 45-minute window, the PackageInstaller module waits for a signal from the Service Control Manager.

  • If it arrives, the package completes without sending a ‘Ready’ state.

  • If it does not arrive within 45 minutes, a ‘Ready’ signal is sent, allowing the next package to start.

The long wait accounts for locked files, save dialogs, or Windows features and updates that can delay rebooting. Typically, the package exits within 20-30 seconds, and the computer reboots. After reboot, the agent automatically signals ‘Ready’ to the backend.

Syntax

void $InputObject.RebootRequested = true

Parameters

None

Return value

None

Example:

PowerShell

$cs.Job_WriteLog("Reboot","Signaling a reboot to the agent to prohibit the next package to run") if ($InputObject.HasCapability("RebootRequested")) { $InputObject.RebootRequested = $true; }

Scripting Guidelines

Related functions