How do I force a reboot using WiseScript?
To create a Force Reboot :
- Go to the Build Settings page under Build Options.
- Check the check box named No Reboot Message During Silent Installs. If you run the install in silent mode, the system will reboot for you.
Another way of forcing a reboot without running your main install in silent mode is to execute a second executable in silent mode. You will need to create a second executable with Wise. Create a script containing one line of code using the Set Variable action in the Script Editor. In the Set Variable dialog, enter RESTART in the Variable field. Enter S in the New Value field and click OK. Go to the Build Settings page in Installation Expert and check the check box No Reboot Message During Silent Installs. Then from your main script, use the Execute Program action to call this .exe file and pass it a command line parameter of /s for silent. This will run the second install in silent mode and force a reboot for the end-user.
Prompt for Reboot:
Wise Installation System controls Restarts via the RESTART variable. When the installation exits, it checks the value of this variable and will prompt for a reboot if the flag is set. If it is not set, then there is no restart prompt.
The different values are
- W: This will restart Windows and not the entire system. For NT, this will log the current user out, and allow another user to log in.
- S: This will reboot the entire system, and not just Windows.
- E (DOS command ): This will execute a program in DOS on a reboot, after rebooting the entire system.
In some cases, the Wise Installation System sets this variable internally. You can check its values, or even overwrite it with another value at any time in the script. Of course, the best place is the last line, so it does not get reset.
If you want to suppress any possible reboots, set the variable RESTART to a blank space or no value at all.