skipau
Posts: 31
Joined: Mon Feb 22, 2010 5:12 am

Problems with updating registry values on maintenance

Hi there,

I am using Advanced Installer 9.2 (Enterprise) and am having a problem with keeping correct values in the registry.

My problem is as follows:

I have an MSI with 2 features - Feature1 and Feature2 which both write values to the registry.

If Feature1 is selected then I write key HKLM\Software\MyValue with default value of "Feature1"
If Feature2 is selected then I write key HKLM\Software\MyValue with default value of "Feature2"
If Feature1 and Feature2 are selected then I write HKLM\Software\MyValue with default value of "Feature2"

To do this I have created the registry keys/values once for Feature1 then I shared them with Feature2 by using the "shift" copy method to copy components from Feature1 to Feature2.
To ensure the correct value was added I created a new Property called MyProp and set it to have a default of "Feature1" as the Value. I set up the registry values to use that Property as the (default) value.
I then added a set installer property custom action which sets MyProp to "Feature2" and I set a condition on that of (&Feature2 = 3 and &Feature2 = 5) so it would set the value to "Feature2" if it was being installed or reinstalled.

That all works fine for just standard installation when selecting Feature1 by itself I get "Feature1" in registry. When I select Feature2 only I get "Feature2" and when I select both Feature 1 and Feature 2 then I get "Feature2" in the registry - all great!

My problem is when I have Feature 1 and Feature 2 installed and do maintenance and remove Feature 2 - my value in the registry just stays as "Feature2"... where as I need it to then go back to "Feature1". Because it is shared across the 2 features I know the value will stay - which is good - but how can I get it to trigger to update the information in it? If I do a repair after it sets it correctly to "Feature1" - which is the result I want...

I tried a different method and using a Property for the registry value - MyProp2 = MyValue and then created 2 entries in the registry - 1 under HKLM\Software\MyValue with default value "Feature1" and putting it in Feature 1, and then a second as HKLM\Software\[MyProp2] with default value "Feature2" and putting it in Feature 2. And not using the custom action etc.. but again i hit problems with maintenance.. with this method the registry entry just gets removed - again if I repair the Feature1 comes back.

So in the end I am stuck.... Would you have any advice on how I can achieve what I am trying to do??

Thanks in advance!!
skipau
Posts: 31
Joined: Mon Feb 22, 2010 5:12 am

Re: Problems with updating registry values on maintenance

Ok - don't worry about this one guys... I had another think about it this morning and I added in a deferred with no impersonation custom action to look after the values..

Basically set it to run on Maintenance only - detects if a component of Feature2 is not installed... (eg. $mycompfromfeature2 <>3) then I trigger a vbscript to update the registry to "Feature1" and I have another one which detects if Feature2 is installed (e.g. $mycompfromfeature2 = 3) then I trigger the script to update the registry to "Feature2"

Which seems to work nicely for me now! So end result is shared components, with a variable for the registry values I need to change, and the the 2 custom actions to handle maintenance...

hopefully that helps someone else... or AI guys/girls - if there is something much easier can you please advise!!! thanks heaps!

Return to “Building Installers”