Executing custom actions before reboot - Advanced Installer Community
mrdcs92
Posts: 7
Joined: Wed Jul 10, 2019 10:43 pm

Executing custom actions before reboot

So in my installer, I am following some of the steps here to allow a user to reboot after the installation is done:
https://www.advancedinstaller.com/user- ... stall.html

Reboot behavior is set to 'Prompt for Reboot when required'. I am setting the REBOOT property to Force, with the condition only being AI_INSTALL. The user is then prompted at the very end as to whether they would like to reboot or not.
If the user chooses yes to reboot, I need to execute a custom action before the reboot actually happens. Is there a way to accomplish this? I don't know what properties to reference from that final prompt, or if the installer can even execute custom actions at that point.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Executing custom actions before reboot

Hello,

To be fully honest with you, I am not quite sure if this is possible.

However, could you please let me know when exactly are you setting the REBOOT property to "Force" so I can run some tests on my end and see if there is something that can be done in this regard?

Or, if you could create a sample project and forward that to me, that would be even better. The project could only contain your settings and the "SetProperty" custom action.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mrdcs92
Posts: 7
Joined: Wed Jul 10, 2019 10:43 pm

Re: Executing custom actions before reboot

I am setting the reboot property to force on the finish button of the exit dialog.

Maybe if I just added a checkbox to the final screen for the user to check if they want to reboot or not? Then set the reboot property based on that, and then have the custom action execute, followed by the reboot.

Thats just my idea of how what a solution could be, but I haven't messed around too much with the different reboot properties. It would be nice if there was some kind of property I could reference from that final prompt, but I am open to any workarounds.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Executing custom actions before reboot

Hello,
Maybe if I just added a checkbox to the final screen for the user to check if they want to reboot or not? Then set the reboot property based on that, and then have the custom action execute, followed by the reboot.
This looks like a good approach, indeed.

This way, the custom action will first be executed and then the property will be set. When the property will be set, the user will be prompted to perform a restart of the machine.

The order of the actions can look like this:

CAOrder.png
CAOrder.png (208.95 KiB) Viewed 2997 times

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”