View Full Version : Trouble with re-execution of CAs after reboot

02-25-2005, 09:19 AM

I am registering and installing some services through an InstallScript Custom Action. The CA uses LaunchAppAndWait to get this done.
These services depend on a lot of COM dlls to be registered which is done through InstallShield's self registration process(the COM info being extracted at build time.)
The problem is I need to call this action only after all the COM components are registered. I can be sure of the registration of dlls only after a reboot. So I need the CA to run only after a reboot. how can I do it? I am using a schedule reboot and the project type is InstallScript MSI.

Also would like to know why my custom installs are being rerun after a reinstall. I have prevented this by creating a registry key called AfterReboot before reboot and using AppSearch to check the presence of the key. After a reboot the AppSearch will find the key, set a property which forms the condition for the CAs. I am not sure how this works because as I understand the conditions for CAs are evaluated at script generation time and I don't think the scripts are regenerated after reboot.

I am at my wits end with this problem. Any help will be highly appreciated.

Tanks a lot in advance

02-25-2005, 12:36 PM
It sounds like this is in an InstallScript MSI project. I think that gives you two options. The MSI way would be to refer to the AFTERREBOOT property (with MsiGetProperty if necessary from your script, or directly if conditionalizing the custom action). The InstallScript way would probably be to reference the OnRebooted event.

02-28-2005, 11:53 AM
Thanks MichealU.
I used the OnRebooted event and the job is done.

But why were my CAs being run after a reboot? What are the possible reasons for such thing to happen.


02-28-2005, 02:11 PM
As I understand it, this is by design in Windows Installer. When the MSI continues after reboot, it will run the entire execute sequence over again. Generally one sets a condition of Not AFTERREBOOT to prevent custom actions from recurring after reboot.

03-01-2005, 08:49 AM
But isn't the AfterReboot condition set only when there is a Forced reboot? I have a scheduled reboot in my sequence and I could find references of AfterReboot being set only for ForcedReboot.


03-01-2005, 11:52 AM
Looks like you're right. Sorry for the misleading info.

"AFTERREBOOT: This property is set to 1 by the installer after a reboot triggered by the ForceReboot action." (http://helpnet.installshield.com/Robo/BIN/Robo.dll?tpc=/robo/projects/InstallShieldXHelpLib/IHelpPropReference.htm)