valiot
Posts: 77
Joined: Tue Dec 04, 2012 1:41 am

Write to Registry on uninstall

I would like to write to the registry upon uninstalling my software. Is this possible?
I want to write the old values that were there before the uninstall.

If not, then another option:
Can I backup an existing registry value before install and restore it upon uninstall?
Daniel
Posts: 8239
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Write to Registry on uninstall

Hello,

In order to achieve what you want you can take a look on our "When to execute registry backup" thread which may be helpful for you.

Let us know if this helps, otherwise please give us more details about your scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
valiot
Posts: 77
Joined: Tue Dec 04, 2012 1:41 am

Re: Write to Registry on uninstall

Actually, I was thinking of creating an msi that creates the registry settings I need. Then I would call this msi during uninstall. Would this work?
Eusebiu
Posts: 4935
Joined: Wed Nov 14, 2012 2:04 pm

Re: Write to Registry on uninstall

Hi,

Please keep in mind that two MSI packages cannot run in the same time.

To avoid this problem, you can call the MSI package that creates the registry settings using a CA added in Finish Dialogs Stage, but in this case it will not be launched if your main installation package is uninstalled from Control Panel. This happens because when an application is uninstalled from Control Panel, it uses Basic UI and it stops right after the Install Execution is finished.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
valiot
Posts: 77
Joined: Tue Dec 04, 2012 1:41 am

Re: Write to Registry on uninstall

What if instead of msi, I create a small executable to write the registry?
Daniel
Posts: 8239
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Write to Registry on uninstall

Hello,

This would be a more suitable approach. You can run the related EXE using a "Launch attached file" custom action with sequence, scheduled during "Install Execution Stage" on uninstall. In this case your custom action will be always executed during uninstall.

Let us know if this helps, otherwise give us more details about your scenario (maybe exemplify).

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
valiot
Posts: 77
Joined: Tue Dec 04, 2012 1:41 am

Re: Write to Registry on uninstall

Well, my main use-case is: I have an application A with specific file associations. When I install application B, I need to replace the file associations with App B. After I uninstall App B, I want to restore the file associations from App A.
Daniel
Posts: 8239
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Write to Registry on uninstall

Hello,

In order to achieve this you can use a custom action. For example you can develop your own exe which will do that. Also, the custom action should be scheduled after "Install Execution Stage -> Remove Resources" action group and should run as deferred with no impersonation.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
valiot
Posts: 77
Joined: Tue Dec 04, 2012 1:41 am

Re: Write to Registry on uninstall

I created an exe to do this and it works great thanks.
Daniel
Posts: 8239
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Write to Registry on uninstall

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

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”