dmh_nrltd
Posts: 20
Joined: Mon Dec 12, 2005 5:35 pm

Force reboot on uninstall

Hi,

Does anyone know how to force Advanced Installer to reboot after an uninstall, but NOT after an install? Our software can install with no reboot, but after an uninstall requires a reboot.

Thanks in advance!
Dave
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi,

These are the required steps:
1. In the Custom Actions page use the Show Standard Action toolbar button and select Before Finalization -> InstallFiles.
2. Right click the InstallFiles item in the tree control and select New Custom Action -> Property Set With Formatted.
3. In the Property Name field type "REBOOT".
4. In the Formatted Text field enter "F".
5. Set the Execution Condition to: (REMOVE="ALL") so the REBOOT property is set only when the application is uninstalled.

Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
dmh_nrltd
Posts: 20
Joined: Mon Dec 12, 2005 5:35 pm

Thanks for the help Denis - works a treat :D
dmh_nrltd
Posts: 20
Joined: Mon Dec 12, 2005 5:35 pm

Force reboot on UPGRADE

On this topic, I'm trying to force a reboot on upgrade as well as on uninstall. I would like the reboot on upgrade to occur after the uninstall phase.

We have a product that can install and run with no reboot. However to uninstall our product a reboot is needed (for drivers to unload). And to upgrad the product, the user must uninstall, reboot, install for it to upgrade successfully.

At present, if v1.0 of the product is installed, and the user clicks Setup.exe for version 1.1, AI will attempt to uninstall the previous version, but will not force a reboot after the uninstall phase, before the re-install. Is there any way to achieve this?

I would be happy if clicking the setup for v1.1 would either:
- simply inform the user that they needed to uninstall v1.0.
- preferably trigger an uninstall of 1.0, then a reboot, then an install of 1.1

Thanks in advance,
David.
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi,

This would be possible with the "ForceReboot" Standard Action, which Advanced Installer does not currently support. However, I have tried adding it manually (with Orca) in the "InstallExecuteSequence" table and everything worked exactly as you described, with one exception: after the reboot, the new version package is not found and thus the installation cannot be resumed. Moreover, if you try to install another MSI package, Windows Installer will perform a rollback of the previously uninstalled program since its installation was not completed. I shall investigate this issue further and let you know if I find a solution.

The second possible approach would be to create a Custom Action that behaves similarly to the "ForceReboot" Standard Action, but this is a (fairly) complex task. This Custom Action, in its simplest form, would be a VBScript that uses WMI (in order to reboot the computer). Please let me know if you want to use this approach and I will create a script that performs this task.

Therefore I shall describe the approach you have already mentioned: simply inform the user that he needs to uninstall the previous version of the program and then abort the installation process. These are the required steps:

1. Create a new text file ("PrevVersionFound.vbs") and copy the following code into it:

Code: Select all

Function PrevVersionFound()
  ShowMsg("Uninstall the previous version first")
  PrevVersionFound = 3
  Exit Function
End Function

Function ShowMsg(strPrompt)
  Const msiMessageTypeUser = &H03000000
  Set record = Session.Installer.CreateRecord(0)
  record.StringData(0) = strPrompt
  Session.Message(msiMessageTypeUser + vbExclamation), record
End Function
2. Make sure that the "FindRelatedProducts" Standard Action is visible under both sequences ("InstallUISequence" and "InstallExecuteSequence").

3. Add a "New Attached Custom Action" on one of the "FindRelatedProducts" stages and select the file you have created previously. Set the following properties for this CA:
- Function Name: PrevVersionFound
- Execution Properties: "Synchronous Execution, check return code"
- Scheduling Options: "Execute only once if present in both sequence tables"
- Execution Condition: OLDPRODUCTS

4. Drag this Custom Action to the "FindRelatedProducts" stage from the other sequence table by holding down the SHIFT key. Make sure that it has the same properties as above (Execution Condition etc).

Although this Custom Action appears twice, it will be executed only once (if the package installs with UI, the CA from the "InstallUISequence" will be executed).

Hope this helps.

Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
dmh_nrltd
Posts: 20
Joined: Mon Dec 12, 2005 5:35 pm

Denis,

Thanks for your reply of some time ago! Have been on other things. Very comprehensive - I must say the support for AI from the team is excellent :)

I have tried the ForceReboot edit, and it worked fine for me, provided the network drive was visible after reboot. I've taken the liberty of adding a feature request.

Also, I was delighted to see that Driver support (DIFx) has been added - another feature request from last year - we can now stop using MsiDb to add this to our msi :)

Cheers,
David.

Return to “Common Problems”