Bewerken

Delen via


System Reboots

The Windows Installer can determine when a reboot of the system is necessary and automatically prompt the user to reboot at the end of the installation. For example, the installer automatically prompts for a reboot if it needs to replace any files that are in use during the installation.

Applications that use Windows Installer version 4.0 or later for installation and servicing automatically use the Restart Manager to reduce system restarts. Windows Installer version 4.0 or later has properties and policies that enable the package author and administrators to control the interaction of Windows Installer with the Restart Manager. For more information, see Using Windows Installer with Restart Manager.

Installation package authors can schedule and suppress reboots by using standard actions in the sequence tables and by setting properties. The following actions and properties are used to handle system reboots.

Action, dialog box, or property Brief description
ForceReboot Action Prompts the user for a reboot during the installation.
ScheduleReboot Action Prompts the user for a reboot at the end of the installation.
REBOOT Property Forces or suppresses certain automatic prompts for a system reboot.
REBOOTPROMPT Property Suppresses the display of prompts for reboots to the user. Any needed reboots happen automatically.
AFTERREBOOT Property Commonly used in a condition imposed on the ForceReboot Action.
InstallValidate Action Displays the FilesInUse Dialog, if necessary, giving users the opportunity to shut down processes and avoid some system reboots.
FilesInUse Dialog Gives users the opportunity to shut down processes to avoid some system reboots.
MsiRMFilesInUse Dialog Gives users the option to use the Restart Manager to close and restart applications. Available beginning with Windows Installer version 4.0.
ReplacedInUseFiles Property Set if the installer installs over a file in use. This property is used by custom actions to detect that a reboot is required.
MSIRESTARTMANAGERCONTROL Property to disable Windows Installer interaction with the Restart Manager. Available beginning with Windows Installer version 4.0.
MSIDISABLERMRESTART Specifies how the Restart Manager closes and restarts applications. Available beginning with Windows Installer version 4.0.
MSIRMSHUTDOWN Specifies how the Restart Manager closes and restarts applications. Available beginning with Windows Installer version 4.0.
MsiSystemRebootPending Installer sets this property if a restart of the operating system is pending. Available beginning with Windows Installer version 4.0.
DisableAutomaticApplicationShutdown Policy to disable Windows Installer interaction with Restart Manager. Available beginning with Windows Installer version 4.0.

 

ERROR_INSTALL_SUSPEND means the installation did not complete or rollback. The installation must resume before it is completed. The system may need to be rebooted before the installation can resume.

The Windows Installer returns the error code ERROR_INSTALL_SUSPEND when the ForceReboot action is run. It returns ERROR_SUCCESS_REBOOT_REQUIRED if a reboot is required before running the application, and it returns ERROR_SUCCESS_REBOOT_INITIATED if the installer has actually started a reboot. Note that because reboots are asynchronous, the reboot may actually occur before the error code is returned. For more information, see Error Codes.

Custom actions can force a prompt for reboot at the end of an installation by calling MsiSetMode. Custom actions can also check for a pending reboot prompt by calling MsiGetMode.

FilesInUse Dialog

The installer can determine when a reboot of the system is necessary and prompt the user with a request to reboot. Commonly, a system reboot is required because the installer is attempting to install a file that is currently being used. If the InstallValidate action detects the installation of a file in use it displays the FilesInUse Dialog.

If you expect the installer to display a FilesInUseDialog, but it does not, this may be due to one of the following reasons:

  • The files in use are not executables.
  • The installer is not actually trying to install those files.
  • The process holding those files is the process invoking the installation.
  • The process holding those files is one that does not have a window with a title associated with it.

For more information, see Logging of Reboot Requests.