/build/static/layout/Breadcrumb_cap_w.png

WPS Return registry to original values during REMOVE

I have a situation where I need a package to reset reg values back to defaults during the REMOVE operation. I have a feature that sets my values using ActiveSetup as there is not an advertisement to trigger the heal. I have two components linked to this feature - CURRENTUSER and RESETUSER. The component CURRENTUSER has condition NOT REMOVE and the other has condition REMOVE. During uninstall, the component with condition REMOVE is not triggering and the registry value is being removed instead of having the default value inserted by the reg value held in the component. Ideas as to what I am doing wrong?

I have also tried using the conditions at the component level vs. feature level and see no difference.

2 hours later - I tried adding a CA to ExDef one step above InstallFinalize and called REG ADD ~~~. The command lne is valid and works fine when copied into a cmd window. I used /f to force the overwrite. For some reason, even this method is not writing the reg values after the MSI removes the stored values.

Jimm

0 Comments   [ + ] Show comments

Answers (14)

Posted by: anonymous_9363 16 years ago
Red Belt
0
ORIGINAL: JimmPanik
The component CURRENTUSER has condition NOT REMOVE and the other has condition REMOVE. During uninstall, the component with condition REMOVE is not triggering
The condition should be

If REMOVE~="ALL"
Posted by: JimmPanik 16 years ago
Orange Belt
0
I tried that too and had no sucess. I also tried a CA with an embedded VBS that did not work. When I run the vbs on it's own, it works fine - same as the cmdline I mentioned previously. Could it be realted to my having this as the line right before InstallFinalize in Execute Deferred?



Below, I have included the VBS that is within the CA:

const HKEY_CURRENT_USER = &H80000001
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strValueName = "1A00"
dwValue = 131072
strkeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2"
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue

It seems so simple. I can't understand why so many different methods are all producing the same result.

Jimm
Posted by: anonymous_9363 16 years ago
Red Belt
0
Those conditions need to be at Feature level.

Run the uninstall with a verbose log. That will tell whether your conditions are being evaluated correctly.
Posted by: JimmPanik 16 years ago
Orange Belt
0
I originally tried at the feature level, then moved to component level. I went as far as to add a simple popup in the vbs that displays showing the script is working. I think the MSI is removing the value after I write the new value to the key.

Jimm
Posted by: anonymous_9363 16 years ago
Red Belt
0
Again, a verbose log will show you what actions are taking place and any property changes.
ORIGINAL: JimmPanik
I think the MSI is removing the value after I write the new value to the key.
Unlikely, unless it sets it to begin with. Even if it is, rescheduling your CA after the built-in RemoveRegistryValues will bypass that.
Posted by: pgiesbergen 16 years ago
Orange Belt
0
Put the action in the execute deferred sequence after the one vbscab mentioned or after installfinalize in installexecute sequnce if the removing user has enough rights for writing the registrykey
Posted by: Inabus 16 years ago
Second Degree Green Belt
0
If your talking about custom actions these are the conditons I used:

Run custom action on install only - Not Installed
Run custom action on uninstall only - REMOVE ~= "ALL"
Run custom action on verify and uninstall only - Installed

I would assume that these same conditions would work on features and components.

P
Posted by: JimmPanik 16 years ago
Orange Belt
0
The CA w/VBS is placed after RemoveRegistryValues in ExDef. I also tried adding it a second time at InstallFinalize. Both failed. I went back and tried using a feature with the reg items added. All I need to do is repalce a value with one that existed prior to the MSI being installed.

I have the log but cannot make much sense of it to see what is happening. Here are the lines that reference my feature name.

This is part of the InstallFinalize portion of the log. The feature is titled Reset_IE_Settings

MSI (s) (1C:60) [10:09:20:682]: Executing op: FeatureUnpublish(Feature=Secured_IE_Site,Parent=CurrentUser,Absent=2,Component=[Bw2mq.mT@IGS&gzT&eD)
MSI (s) (1C:60) [10:09:20:682]: Note: 1: 1402 2: UNKNOWN\Installer\Features\9C5E28AD526981348A2703F01F476D2F 3: 2
MSI (s) (1C:60) [10:09:20:682]: Executing op: FeatureUnpublish(Feature=CurrentUser,,Absent=2,Component=[UFl,xI`K?Cb%{U.U'+uSYiag3{t7AvmUm'8`a'k)
MSI (s) (1C:60) [10:09:20:682]: Note: 1: 1402 2: UNKNOWN\Installer\Features\9C5E28AD526981348A2703F01F476D2F 3: 2
MSI (s) (1C:60) [10:09:20:682]: Executing op: FeatureUnpublish(Feature=Reset_IE_Settings,Parent=CurrentUser,Absent=2,Component='^gK8yQ5e=&@Orb%8l5.)

I still have my CA in the script but it is commented out. Here is what I found in the log under Actions - Remove RegistryValues: The CA name is Reset 1A00 Registry - the log states condition is false. I assume this is due to it being commented.

MSI (s) (1C:60) [10:09:20:532]: Doing action: RemoveRegistryValues
Action ended 10:09:20: UnregisterFonts. Return value 1.
Action start 10:09:20: RemoveRegistryValues.
MSI (s) (1C:60) [10:09:20:552]: Skipping action: Reset 1A00 Registry (condition is false)
MSI (s) (1C:60) [10:09:20:552]: Doing action: UnregisterClassInfo
Action ended 10:09:20: RemoveRegistryValues. Return value 1.
MSI (s) (1C:60) [10:09:20:552]: Note: 1: 2205 2: 3: Class
MSI (s) (1C:60) [10:09:20:552]: Note: 1: 2228 2: 3: Class 4: SELECT `BinaryType`, `CLSID`, `ProgId_Default`, `Class`.`Description`, `Context`, `Feature_`, `ComponentId`, `Component`, `Class`.`Attributes`, `AppId_`, `FileTypeMask`, `Icon_`, `IconIndex`, `DefInprocHandler`, `Argument`, `Component`.`RuntimeFlags`, `FileName`, `Component`.`Directory_`, `Component`.`Action`, `Component`.`Installed`, `Feature`.`Action` FROM `Class`, `Component`, `File`, `Feature` WHERE `Feature_` = `Feature` AND `Class`.`Component_` = `Component` AND `Component`.`KeyPath` = `File`.`File` AND (`Feature`.`Action` = 0 OR (`Feature`.`Action` = 4 AND (`Feature`.`Installed` = 1 OR `Feature`.`Installed` = 2)) OR ((`Feature`.`Action` = NULL OR `Feature`.`Action` = 3) AND `Component`.`Action` = 0 AND (`Feature`.`Installed` = 1 OR `Feature`.`Installed` = 2)))

The line for WriteRegistryValues shows that the action did nothing. I would think that because I am using a feature, this should have triggered.

Jimm
Posted by: anonymous_9363 16 years ago
Red Belt
0
ORIGINAL: JimmPanik
The line for WriteRegistryValues shows that the action did nothing. I would think that because I am using a feature, this should have triggered.
Then you would be wrong :) That action is the one which writes the entries contained in the Registry table.

The CA name is Reset 1A00 Registry - the log states condition is false. I assume this is due to it being commented. Correct. If you look in the InstallExecuteSequence table, the 'Condition' column for that CA's row probably looks like 0 AND REMOVE~="ALL"

Looking at the log, you should be able to see that your CA is actioned before RemoveRegistryValues completes:

MSI (s) (1C:60) [10:09:20:532]: Doing action: RemoveRegistryValues
Action ended 10:09:20: UnregisterFonts. Return value 1.
Action start 10:09:20: RemoveRegistryValues.
MSI (s) (1C:60) [10:09:20:552]: Skipping action: Reset 1A00 Registry (condition is false)
MSI (s) (1C:60) [10:09:20:552]: Doing action: UnregisterClassInfo
Action ended 10:09:20: RemoveRegistryValues. Return value 1.

Line 1 - RemoveRegistryValues action is scheduled
Line 3 - RemoveRegistryValues action is starts
Line 4 - Reset 1A00 Registry action is scheduled
Line 6 - RemoveRegistryValues action ends

Try moving it further down the sequence. It doesn't have to be close to it at all. Try it right before InstallFinalize and - hopefully obviously - remove the comment :)

BTW, I've always avoided spaces in my CA names: I wonder if that's a problem? It won't hurt to change your CA name to Reset1A00Registry. Lastly, I generally add a suffix to indicate which sequence a CA is in. Thus, in my MSIs, your CA would be called 'Reset1A00Registry_ED'. Each to his own, though...
Posted by: JimmPanik 16 years ago
Orange Belt
0
I placed a few pauses in there and learned that the value is correct after WriteRegistryValues. After RemoveRegistryValues, the key is being deleted.

Jimm
Posted by: JimmPanik 16 years ago
Orange Belt
0
I just realized another issue. I used active setup to place the reg value in each profile reg (HKCU). I would also need to replace the value in each profile back to the original value. Is it possible to make a bogus Active Setup key - i.e. RegReset and use the cmdline reg add ~ to put the values back as the users logon? My thought is that by using a seperate setup key instead of using the product code, I could leave it there after the MSI is removed.

Jimm
Posted by: anonymous_9363 16 years ago
Red Belt
0
I would add that functionality to the current script you already run via AS, i.e. test if the product is uninstalled and if so, set the relevant registry value. Having multiple ASs for the same product is probably sub-optimal.

But hang on...all this while, I've been assuming the registry stuff is being done in the MSI - with talk about conditions and features, etc. - and now it turns out it's via AS. Which is it?
Posted by: JimmPanik 16 years ago
Orange Belt
0
I've actually done this a few different ways trying to get a method that would do everything I need. As it stands currently, I have a feature that does the HKCU reg and file stuff using AS during install. I also wanted something that could relace the HKCU reg with the original values during uninstall.

What I am doing is adding a secured site in IE. The default settings can be set in the reg to add the site and zone data. I also need to chaneg the value HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2\1A00 to value hex 10000. When the app is removed, I want to place this value back to 0 as there are no logon credentials cache to pass. Thus the need to replace reg values during remove.

This was the piece that I struggled with. I tried different features with conditions, components with conditions, CAs with conditions and re-ordering the actions in the scripts in both ExDef and ExIm. The CAs used external commands for reg.exe and calling an embedded VBS.
Posted by: anonymous_9363 16 years ago
Red Belt
0
See Post #10, then.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ