I faced one issue that my application is having one active setup registry which runs after installation and logoff/login. when i tried to uninstall and resinstall the same product, the active setup is not executed as its available already. Any solution is there to remove active setup hcku registry key during uninstall of the product.?
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

1

You should write a vbscript to delete the HKCU keys and place it somewhere in Allusersprofile. Then you need to write a custom action to add a active setup key at uninstall and this active setup key should run the delete reg script placed earlier.

Answered 04/10/2012 by: piyushnasa
Red Belt

Please log in to comment

Answers

0

Active setup uses HKLM\software\microsoft\Active Setup\Installed Components\Name_or_id to uniqually identify the instance. If you use the MSI's GUID as the name_or_id part it will be globally unique. When a user logs in the HKLM part is compared with the value in HKCU and if it doesn't exist Active Setup runs whatever is in StubPath and then sets the HKCU key so it doesn't happen again.

If you uninstall the msi that wrote the HKLM part of the active setup then it won't run for any users after the uninstall as the HKLM part won't exist. If you re-install that same msi but increment the version value in the active setup key then it will run again for each user. The format for the version key is Version = a,b,c,d. Usually you start with version set to 1,0,0,0, then you can use 1,0,0,1 or 2,0,0,0 depending on how you want to do it. So long as you increment it on each version of your msi then it will always run for each user.

Answered 04/13/2012 by: olditguy
Second Degree Blue Belt

Please log in to comment
0
In you package along with Stubpath add another string value "Version", and assign it value 1.
Refer this link to understand more :
http://www.sepago.de/helge/2010/04/22/active-setup-explained/

Also it is very important to add a custom action that runs during uninstall. This custom action should increment the value of "Version". For your reference use this script:
VBScript Code:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Option Explicit

On Error Resume Next

Dim objShell,intVersion

Set objShell = CreateObject("WScript.Shell")



intVersion = objShell.RegRead("HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{ProductCode}\Version")

intVersion = intVersion + 1

objShell.RegWrite "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{ProductCode}\Version", intVersion , "REG_SZ"



Set objShell = Nothing

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Answered 04/06/2012 by: akki
Fourth Degree Black Belt

Please log in to comment
0

HKCU and ActiveSetup is an interesting challenge.  Keep in mind that these keys exist for everyone who has logged in since the application was installed.  There are really 2 ways to deal with this: load every user reg hive and delete the keys, or increment the ActiveSetup version to run if there's a reinstall.  Both have challenges - dealing with locked hives or hives that don't unload, and having someone log in after the uninstall and trying to run the ActiveSetup are the first 2 that come to mind. 

Answered 04/10/2012 by: Arminius
Second Degree Green Belt

  • Oops, submitted too quickly. My client, who puts everything in a WinBatch wrapper, had me write a function that loads all the registry hives and delete the keys. In the strictest way of thinking, that would make sense as the best way to deal with ActiveSetup.
Please log in to comment
Answer this question or Comment on this question for clarity