AdrianH
Posts: 11
Joined: Tue Jun 24, 2008 1:10 pm

Update registry from custom action

Hi

Is it possible to update and/or delete keys and values from the registry from a custom action. I know I need to set the condition of the action to REMOVE="ALL" AND (NOT UPGRADINGPRODUCTCODE)
as I only want it to run on a full uninstall. I am hoping that it can be accomplished in scipting without having to write a small application.

Regards
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Update registry from custom action

Hi,

Please note that you can add or update registry entries by using the Registry page. However, if you want to use a custom action, you can find some sample VBScript code here:
http://www.activexperts.com/activmonito ... /registry/

This code can be added into a .VBS file which can be used as an Attached custom action.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
AdrianH
Posts: 11
Joined: Tue Jun 24, 2008 1:10 pm

Re: Update registry from custom action

Hi

Thanks for the reply.

I am struggling to remove the registry entries. PLease can you have a quick look and see if you can see anyting wrong.

This is my VBS method:

Function cleanupRegistry()
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\MyApplication"
strStringValueName = "MyRegistryEntry"

oReg.DeleteValue(HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName)
oReg.DeleteKey(HKEY_LOCAL_MACHINE, strKeyPath)
End Function


Thanks
AdrianH
Posts: 11
Joined: Tue Jun 24, 2008 1:10 pm

Re: Update registry from custom action

Hi,

Don't worry, I was missing the comma's in the script.

Thanks for your time.

Return to “Common Problems”