There is a particular registry value that my application sometimes creates during execution, i.e. N开发者_Python百科OT at installation. This value is within a registry key that I don't want to delete; I just want to delete the value that I created. Because it's not created at install it's not automatically deleted at uninstall by windows installer. What can I do in the MSI to delete this value if it exists?
The Registry table doesn't seem to have this option. Does that mean I have to write a custom action? If so, anyone have any examples?
I'm using Wise Windows Installer Edition to create the MSI.
Also posted here.
Sorry, you will need a custom action.
You do need to do a custom action.
I ended up implementing this with a custom action placed after the WriteRegistryValues within Deferred section.
The .vbs to delete the key is like this:
const HKLM = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Mozilla\Firefox\Extensions"
strValueName = "myext@myco.com"
oReg.DeleteValue HKLM,strKeyPath,strValueName
精彩评论