NigelShaw
Posts: 58
Joined: Wed Apr 01, 2015 12:45 am

Registry - Skip existing Values

Tue Aug 02, 2022 8:30 pm

Hi

I am adding some registry values into a SubKey during an install but want to add / update them if they dont exist. If they do exist, i need to not update the values.

Thanks

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Registry - Skip existing Values

Wed Aug 03, 2022 10:43 am

Hello,

In order to achieve this, you can follow these steps:

1. Go to the "Search" page and create a New Search.

2. Use the "Add Search Location" context menu to add the Registry as the search location.

3. Add your key's information.

4. Go to the "Registry" page and add the key in the intended location.

5. Press F8 while the registry key is selected (this will identify the registry key's component in the Organization page) or right click on your key and press on the "Go to Component" option.

6. Add the search name as the condition for the component in the "Condition" field.

In this way the installer will perform a search for your registry key at the beginning of the installation and install its component only if it is not already present on the target machine.

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

NigelShaw
Posts: 58
Joined: Wed Apr 01, 2015 12:45 am

Re: Registry - Skip existing Values

Sat Aug 27, 2022 2:13 am

Hi

I want to make sure i have my logic right for updates and registry values.

I have followed your guide above however, the registry values are still getting reset when i do an update. I have the installer set to uninstall previous version first. If i uncheck this, will an update simpley overwrite the existing files without forming an uninstall? I feel that the uninstall process is removing the registry values then the update is adding them back.

Alternatively, should i be running updates on a different Installer project? Ideally i want to do the following-

Install - all all of the executables and referenced libraries to the app folder, add all the registry keys - Size = 60mb
Update - add only the files that have changed, add only new registry keys - Size = 7mb
Remove - Renove all files from install & updates including all registry keys (could simply delete the app folder & parent reg key i guess)

Could you please clarify the best way to approach this?


Thanks

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Registry - Skip existing Values

Mon Aug 29, 2022 11:19 am

Hello,
I have followed your guide above however, the registry values are still getting reset when i do an update.
Please have a look on our How do I prevent a file or registry entry from being uninstalled or repaired? article.

You can also check the below forum thread which debates the same scenario:

How do i preserve registry entries?

To preserve your registry key during upgrade you can right click on your key --> Properties --> Operations tab and check the "Preserve key content" option with the "OLDPRODUCTS" condition.
reg key.png
reg key.png (137.27KiB)Viewed 7214 times
Update - add only the files that have changed, add only new registry keys - Size = 7mb
Regarding this, I've replied with more details on the other thread you opened. The solution to this is to use a patch. Please check my reply on the other thread.

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

NigelShaw
Posts: 58
Joined: Wed Apr 01, 2015 12:45 am

Re: Registry - Skip existing Values

Mon Aug 29, 2022 4:12 pm

Hi

Its not the best solution.

The method you have shared shows the action on the key but not on the keys values. In the key, i have 12 values, 4 of which do not require a value change on an upgrade but the others might. I didnt really want to separate the protected key values into another key as that would be a code update..

I created a search to get the raw value
i set some property values in Organization
- CONDITION=SEARCH_REG_PERSON_ID (the search property i created)
- 64-bit Component=TRUE
- Never Overwrite=TRUE

Question regarding Never Overwrite
the help files call this out-
Never Overwrite
The component is not installed or reinstalled if a key path file or a key path registry entry for the component already exists. This affects only future installers which try to overwrite the component key path; it doesn't affect already installed resources.
This claims that a registry value would remain but as i correct in thinking that the in order for this work, the registry keys would need to have been created with the installer so that settings could be applied? In other words, if they existed before the install, they would be excluded from the said property settings?

for now i have set them as permanent, uninstalled the application, deleted the registries and re-installing from fresh.

Regarding my other post, I looked at patches but there are 2 issues have with them-
1. it would be an additional install phase id need to manage and we only want 1 file floating
2. they dont compile as .exe

i am not permitted by our IT to run patches. they have specific rules in place to prevent the download of msi files and patches (as far as they are concerned) can be as good as virus files which they cannot separate automatically so the easiest thing to do is blanket denial of msi files.

Thanks

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Registry - Skip existing Values

Tue Aug 30, 2022 1:48 pm

Hello,
The method you have shared shows the action on the key but not on the keys values. In the key, i have 12 values, 4 of which do not require a value change on an upgrade but the others might.
Then, in this case you can condition the installation of the specific component using the Condition field. You can add the OLDPRODUCTS condition or your custom condition for the values you want to preserve.
This claims that a registry value would remain but as i correct in thinking that the in order for this work, the registry keys would need to have been created with the installer so that settings could be applied? In other words, if they existed before the install, they would be excluded from the said property settings?
If the value already exists (even if is not created by a previous installation) it will not be overwritten. You can test this by manually creating a specific registry key using regedit and then set the "Never Overwrite" option for it in your project.
Regarding my other post, I looked at patches but there are 2 issues have with them-
1. it would be an additional install phase id need to manage and we only want 1 file floating
2. they dont compile as .exe

i am not permitted by our IT to run patches. they have specific rules in place to prevent the download of msi files and patches (as far as they are concerned) can be as good as virus files which they cannot separate automatically so the easiest thing to do is blanket denial of msi files.
Regarding this, next time please reply in the specific forum thread and avoid to mention the same issue in multiple threads (it's really hard for us to follow them across multiple threads). Thank you for understanding.

Now, unfortunately the only solution for this is to use a patch as it is much smaller in size and it consists of the diffs between two packages. If you cannot use the patches, the only solution for you is a major upgrade.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

NigelShaw
Posts: 58
Joined: Wed Apr 01, 2015 12:45 am

Re: Registry - Skip existing Values

Fri Sep 02, 2022 4:59 am

Hi there!

Ive tried every possible way i can think of to try and get a registry value not to be overwritten but my efforts are not successful. Even when the reg value is set to Do Not Overwrite & Permanent & Do not register with windows installer, it still overwrites. furthermore, i tried adding searches but every time there was a search condition added to the reg value, it was deleted from the registry upon an reinstall or update.

Ive decided to move the complete registry method to my application in a registry class because that is something i manage freely and successfully. I simply check for the registry value existing and if it doesnt exist, add it. If it does exist, leave it alone.

i have left the installer to add some registry values, ones that will remain static through the lifecycle.

Thanks for the efforts, i just dont think there is a solution for this in Advanced Installer.



Thanks

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Registry - Skip existing Values

Fri Sep 02, 2022 8:10 am

Hello,

Thank you for your follow-up.

Glad you were able to find another solution.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”