Detect Service = "started" and stop the uninstalling

Request new features that you would like to see in the next version of Advanced Installer.

Detect Service = "started" and stop the uninstalling

Postby clamarazu » Fri Mar 09, 2012 12:09 am

Hi,

I have this problem. I need to dectect if a windows service its status is "started". If its status is "started" I need to show a message to indicate that the uninstalling cannot continue until the service´s status changes to "stopped". I have created a custom action "Detect service", but I don´t know how to do the validation.

Thanks.
clamarazu
 
Posts: 5
Joined: Mon Feb 20, 2012 11:00 pm

Re: Detect Service = "started" and stop the uninstalling

Postby Cosmin » Tue Mar 13, 2012 9:47 am

Hi,

This is not recommended because it prevents the user from uninstalling the application. Even if the service is running, the uninstall can still be performed. The only inconvenience is that it would need a reboot to finish.

However, if you really want to prevent the uninstall, you can try this approach:
- make sure that your Detect Service custom action is scheduled before InstallUISequence -> LaunchConditions standard action (for example you can move it after AppSearch action)
- in the custom action properties pane set the service name in Action Data field
- condition this action to run only during uninstall
- while SHIFT key is pressed drag it over InstallExecuteSequence -> AppSearch standard action so it also runs for silent installations
- in the action properties pane select Execute only once if present in both sequence tables option
- when the custom action will be executed, the AI_SERVICE_STATE property will be set to Started, Stopped or Not Found, depending on the service
- you can use the AI_SERVICE_STATE property as a custom launch condition, for example:
Code: Select all
Condition:
AI_SERVICE_STATE <> "Started"

Message:
An uninstall cannot be performed until service <your service> is stopped.

Launch conditions are evaluated only during install by default, so you need to remove the condition for LaunchConditions action in both InstallUISequence and InstallExecuteSequence. For this you can simply show the LaunchConditions action in Custom Actions page, select the action and change its condition.

Regards,
Cosmin
Cosmin Pirvu
Advanced Installer Team
http://www.advancedinstaller.com/
Cosmin
 
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 4 guests