cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Simon_Yang
Level 6

How to know user click "cancel" button during uninstall?

I had a basic MSI project. When user uninstall from ""Add or Remove Programs", I will use a custom action to reset some settings. Howerver, if user click "cancal" button, I want to use another custom action to set those settings back.

The problem is how can I know user clicked "cancel" button.


Anyone has idea about that? Thanks!
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

You'll want to investigate rollback custom actions, a type of custom action intended to reverse the effects of deferred actions during a failed or canceled installation or uninstallation.

(Commit actions can clean up temporary data saved for the possible use of a rollback action, but first things first.)
0 Kudos
Simon_Yang
Level 6

Hi Thanks for reply!

I just tried to use rollbeck custom action. What I did is first , I created custom action named as "StopService" which will stop a service. I set it as immediate execution. Then I created another custom action named as "StartService" which will start the service. I set it as Rollback Exection. In the sequences, StartService is behind StopService.

I hope, when I uninstalled the product, StopService will be called first. Then, if I clicked cancel button, StartServoce will be called. It can just reverse what StopService did.

In fact, when I clicked cancel button during, StartService was not be called.

Can anyone tell me why? Thanks a lot!!!
0 Kudos
RobertDickau
Flexera Alumni

Some general points:

Only deferred actions can be rolled back (which makes sense, since only deferred actions should make system changes). Immediate actions should set properties and query the system, but not touch the target machine.

A rollback action should be placed in the sequences before the action it rolls back.

Not a technical issue, but there are standard actions called StartServices and StopServices, so you might slightly rename yours to avoid confusion.

If all else fails, creating an MSI log file should help understand whether/why actions are or are not being executed.
0 Kudos
Simon_Yang
Level 6

Thanks a lot!!!
0 Kudos