How can I reboot during installation?



1 comment

  • Avatar

    Unfortunately it is not trivial to perform the process of rebooting a machine and automatically resuming installation after the reboot.

    As for restarting itself, it is enough to run shutdown /r /t 0 command to reboot a machine. The <runProgram> action can be used for this - such as:

    <runProgram> <program>shutdown</program> <programArguments>/r /t 0</programArguments> <ruleList> <isFalse> <value>${reboot_already_performed}</value> </isFalse> </ruleList> </runProgram>

    The action is documented in Run Program section of InstallBuilder user guide.

    You can check early in the installation process if the role exists - and if not, show information that installer will add it and reboot system, then add the role and reboot the machine if the user accepts this.

    It is also possible to add installer to Run or RunOnce (i.e. to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce) so it is started automatically at next system startup - however, that may not be that simple if the installer requires UAC elevation.

    This may require creating a helper .bat script that will be run without elevation and use start command to run the actual installer, which will require elevation.

Please sign in to leave a comment.