How do I resume the setup program after a reboot?
In order to have the setup restart after the reboot, you will need to manually add the path to your .msi into the RunOnce key (shown below), then conditionalize the dialogs so they do not display the second time through.
- Select the line in the upgrade .msi right after FindRelatedProducts action in the Execute Immediate script.
- Double-click on the Run WiseScript from installation action. A dialog will open.
- Name the WiseScript (something meaningful to you, such as Setup Runonce), then select the Options button.
- Select Create New WiseScript.
- Add the following registry key into the WiseScript so that they are placed down when the upgrade is run.
Note: Use the Current User vs the Local machine key if the installation is a per user install.
- The value for the RunOnce key should be the OriginalDatabase property in square brackets. The OriginalDatabase property holds the path to the .msi that is getting executed.
- Another registry key should also be added in the WiseScript that will set a flag. The flag indicates that the installation was run once on the computer. This can be any registry key, and it will be checked later by the installation.
- Compile the WiseScript and close it. You will then return to the Installation Expert script with the dialog open.
- Select OK on the Run WiseScript from Installation Details dialog to close the dialog.
- Conditionalize the execution of the WiseScript you just added by placing an If Statement before the Run WiseScript from Installation action and and End Statement after. The condition in the If Statement should check to see if the installation is running as an upgrade.
The property to use in the If Statement can be found in the Upgrade page in the Upgrade dialog in the Action Property field. It is usually UPGRADE_1, but may be incremented to UPGRADE_2 or UPGRADE_3. Placing this condition down will ensure that the runonce key is only set for upgrades. This property will resolve to true if it is an upgrade and false if it is not. The Windows Installer evaluates a property to true or false based on if it is populated. The Upgrade property will not be populated if it is not an upgrade and will evaluate to false and not execute the WiseScript if it is not an upgrade.
- Go to the System Search page, and create a search for the registry key that you placed using the WiseScript. Create a property value that will hold the results of the search.
- Set a property on the dialogs that will not disable the dialogs if the application runs a second time. The property from the System Search should be used to conditionalize the dialog. It will check if it is the second time through and not display the dialogs again.
On all displayed dialogs, check to see if the property that you placed in the WiseScript has been set using the System Search as described in Step 11. You can do this in the Dialogs page of Installation Expert. Double-click on a dialog and edit the Condition for the dialog. If a condition already exists append the additional condition to the existing condition by appending AND NOT <PROPERTY>. The property value here should be the property created in the system search.
Rate this Article