Bewerken

Share via


ForceReboot Action

The ForceReboot action prompts the user for a restart of the system during the installation. The ForceReboot action is different from the ScheduleReboot action in that the ScheduleReboot action is used to schedule a prompt to restart at the end of the installation.

If the installation has a user interface, the installer displays a dialog box at each ForceReboot action which prompts the user to restart the system. The user must respond to this prompt before continuing with the installation. If the installation has no user interface, the system automatically restarts at the ForceReboot action.

If the installer determines that a restart is necessary, it automatically prompts the user to restart at the end of the installation, whether or not there are any ForceReboot or ScheduleReboot actions in the sequence. For example, the installer automatically prompts for a restart if it needs to replace any files used during the installation.

Suppress certain restart prompts by setting the REBOOT property.

If the Windows Installer encounters the ForceReboot or ScheduleReboot action during a multiple-package installation, the installer will stop and roll back the installation. Other packages belonging to the multiple-package installation, that do not contain a ForceReboot or ScheduleReboot action, can be installed.

Sequence Restrictions

The following actions commonly occur together as a group in the action sequence. It is recommended that the ForceReboot action be scheduled to come after this group. If the ForceReboot action is scheduled before the RegisterProduct action, the installer again requires the source of the installation package after the restart. Therefore, the preferred sequence for ForceReboot is immediately following this action sequence.

The ForceReboot action must come between InstallInitialize and InstallFinalize in the action sequence of the InstallExecuteSequence table.

ActionData Messages

There are no ActionData messages.

Remarks

The ForceReboot action must always be used with a conditional statement such that the installer triggers a restart only when necessary. For example, a restart may only be required if a particular file is replaced or a particular component is installed. Each product installation is unique and a custom action may be required to determine whether a restart is needed. The condition on the ForceReboot action commonly makes use of the AFTERREBOOT property.

ForceReboot runs system operations generated by any previous actions before prompting for a restart or restarting. For example, the system operations generated by InstallFiles and WriteRegistryValues are run before a restart.

The ForceReboot action writes a registry key that causes the installer to start after restarting. The location of this key is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce.

System Reboots