othulke
Posts: 27
Joined: Thu Aug 01, 2013 1:51 pm

Stopping service before InstallValidate and re-starting it

Hi everyone,

one of our setup projects is installing and starting a service, which works fine. On Windows XP the uninstallation also works as expected, but on Windows 7 a reboot is requested if the service is found running. As this is an issue with the Windows Installer 5.0 I tried working around it but simply stopping the service before InstallValidate as suggested somewhere else in the forum (using an immediate CA calling a native DLL function). This works as desired.

However should the user decide to hit the cancel button during the uninstallation (mainly during InstallValidate because other programs from the same installer are in use), the service will remain in the stopped state until it is restarted manually or the system is rebooted.

Is there any way to trigger a restart of the service when the user cancels the uninstallation?

I haven't tested yet, but I would expect this issue to also arise during installation of an upgrade and even during maintenance (repair). So it is of vital importance to properly restart the service.

Any help on this issue would be highly appreciated!

Thanks,
Oliver
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Stopping service before InstallValidate and re-starting

Hello Oliver,

Please take a look on the Restart Windows Service after AI_MAINT thread which debates a similar issue.

If you need any help, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
othulke
Posts: 27
Joined: Thu Aug 01, 2013 1:51 pm

Re: Stopping service before InstallValidate and re-starting

Hello Dan,

thanks for your fast reply! It appears the linked thread focuses on restarting the service after successfully completing maintenance.

What I'm looking for is restarting a service when the user presses the Cancel-button during maintenance or even uninstall.
I assume CAs configured after "Install Execution Stage" -> "Add Resources" will not be running when canceling the setup.

If I overlooked something important in the mentioned thread please let me know.

Best regards,
Oliver
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Stopping service before InstallValidate and re-starting

Hi Oliver,

In order to achieve that you can use a publised event control on the "Cancel" button.
So, you can go in the "Dialogs" page and select the "CancelDlg" - Specialized Dialogs. On the related dialog, select the [Yes] button and from the "Published Events" tab add a published event using the [New..] button.

Please take a look on the Execute custom action on button push article which may be useful to you.

If you need any help, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
othulke
Posts: 27
Joined: Thu Aug 01, 2013 1:51 pm

Re: Stopping service before InstallValidate and re-starting

Hi Dan,

thanks for your support. I've got it working as desired using the solution you outlined in your reply.

Best regards,
Oliver
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Stopping service before InstallValidate and re-starting

You're welcome Oliver. I'm glad you got this working.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”