installing reg keys on uninstall
hi guys,
i have a messy vendor msi that removes some keys on uninstall that breaks one of our in-house services that are on the build.
i have narrowed it down to HKCR keys but there are alot of them.
I want to install these on uninstall via my mst.
what is the best way to do this?
should i create a component add the keys and put the condition REMOVE~="ALL" on that component?
should i create a custom action to import the .reg file perhaps?
any feedback welcomed!
i have a messy vendor msi that removes some keys on uninstall that breaks one of our in-house services that are on the build.
i have narrowed it down to HKCR keys but there are alot of them.
I want to install these on uninstall via my mst.
what is the best way to do this?
should i create a component add the keys and put the condition REMOVE~="ALL" on that component?
should i create a custom action to import the .reg file perhaps?
any feedback welcomed!
0 Comments
[ + ] Show comments
Answers (17)
Please log in to answer
Posted by:
nheim
17 years ago
Posted by:
frodo
17 years ago
cheers nick,
is it possible to do this without installing the .reg file.
for example run the command line and query the binary table for the reg file?
I need to do my CA at the very end of uninstall . After a quick think i believe i will have to install the reg file and leave it as permanent so it does not get uninstalled by the remove files action.
i then need to run a CA that runs the command line regedit.exe /S MyKeys.reg.
how can i do this without installing the reg file to a location so that my Ca can use it?
thanks again for your help Nick.
is it possible to do this without installing the .reg file.
for example run the command line and query the binary table for the reg file?
I need to do my CA at the very end of uninstall . After a quick think i believe i will have to install the reg file and leave it as permanent so it does not get uninstalled by the remove files action.
i then need to run a CA that runs the command line regedit.exe /S MyKeys.reg.
how can i do this without installing the reg file to a location so that my Ca can use it?
thanks again for your help Nick.
Posted by:
AngelD
17 years ago
Find the registry entries you don't want to be removed during uninstall and check which component(s) these are part of. Then make these component(s) permanent so they will not get removed during uninstall. To do this add the msidbComponentAttributesPermanent attribute bit to the Attributes column in the Component table for the components you found previous.
Posted by:
JdotQ
17 years ago
ORIGINAL: frodo
should i create a component add the keys and put the condition REMOVE~="ALL" on that component?
Not sure if it's a typo, but figured I would mention it anyway...
With conditions, REMOVE = "ALL" will be executed during an uninstall sequence, REMOVE <> "ALL" will be executed during an install sequence (at least this syntax is true for AdminStudio, not sure about Wise but I think it would the same/similar)
(( Please correct me if I'm wrong [:D] ))
Posted by:
AngelD
17 years ago
Posted by:
frodo
17 years ago
ok guys,
just to be clear, i added the keys to a permanent component but no joy.
the vendor msi removes the keys via a custom action and i cant pinpoint which one.
my only option is to use a custom action to install the reg keys on uninstall.
with that in mind,
i have my .reg file and my command line to run it regedit /s mykeys.reg
is there anyway i can run it without installing the .reg file to the local machine?
i know i could create a vb custom action to create each key but i dont have the time to go through the .reg and add each key to the vb code!
help on this custom action creation is much appreciated.
just to be clear, i added the keys to a permanent component but no joy.
the vendor msi removes the keys via a custom action and i cant pinpoint which one.
my only option is to use a custom action to install the reg keys on uninstall.
with that in mind,
i have my .reg file and my command line to run it regedit /s mykeys.reg
is there anyway i can run it without installing the .reg file to the local machine?
i know i could create a vb custom action to create each key but i dont have the time to go through the .reg and add each key to the vb code!
help on this custom action creation is much appreciated.
Posted by:
nheim
17 years ago
Hi Mark,
i would do this with reg.exe not with regedit.
If you can be sure, this MSI will be only installed on XP, you can rely that reg.exe is on the clients.
Create a batch batch file with a reg entry for each line, you have to write and put it into the binary table.
Call it with a deferred CA right before InstallFinalize.
Hope, this gives you some ideas.
Regards, Nick
i would do this with reg.exe not with regedit.
If you can be sure, this MSI will be only installed on XP, you can rely that reg.exe is on the clients.
Create a batch batch file with a reg entry for each line, you have to write and put it into the binary table.
Call it with a deferred CA right before InstallFinalize.
Hope, this gives you some ideas.
Regards, Nick
Posted by:
frodo
17 years ago
Posted by:
nheim
17 years ago
Posted by:
frodo
17 years ago
Posted by:
nheim
17 years ago
Posted by:
AngelD
17 years ago
Nick,
Just of interest, why can't he use regedit to import a .reg file?
Anyway here is a vbscript that you could use as a custom action to extract the .reg file from the Binary table, run regedit to import the file and delete the exported .reg file. You have to add the code for execution of regedit yourself.
Make sure to change the BinaryName value to the PrimaryKey From the binary table for your .reg file.
Just of interest, why can't he use regedit to import a .reg file?
Anyway here is a vbscript that you could use as a custom action to extract the .reg file from the Binary table, run regedit to import the file and delete the exported .reg file. You have to add the code for execution of regedit yourself.
Make sure to change the BinaryName value to the PrimaryKey From the binary table for your .reg file.
Dim BinaryName : BinaryName = "PrimaryKeyFromBinaryTable"
Dim TempFile : TempFile = ReturnTempFile()
Call ExtractBinary(BinaryName, TempFile)
'// import .reg file using regedit
Call DeleteFile(TempFile)
Function ExtractBinary(BinaryName, OutputFile)
Const msiReadStreamAnsi = 2
Dim Database : Set Database = Session.Database
Dim View : Set View = Database.OpenView("SELECT * FROM Binary WHERE Name = '" & BinaryName & "'")
View.Execute
Dim Record : Set Record = View.Fetch
Dim BinaryData : BinaryData = Record.ReadStream(2, Record.DataSize(2), msiReadStreamAnsi)
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
Dim Stream : Set Stream = FSO.CreateTextFile(OutputFile, True)
Stream.Write BinaryData
Stream.Close
End Function
Function ReturnTempFile()
Const TemporaryFolder = 2
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
Dim TempFolder : Set TempFolder = FSO.GetSpecialFolder(TemporaryFolder)
Dim Tempfile : Tempfile = FSO.GetTempName
ReturnTempFile = TempFolder.Path & "\" & Tempfile
End Function
Function DeleteFile(FilePath)
On Error Resume Next
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.DeleteFile(FilePath, True)
End Function
Posted by:
nheim
17 years ago
Hi AngelD,
you just proved me wrong with this one. Have used this method a few times too (although, not with registry files).
Just thought, it would complicate things more, than use a single VB script file. But this maybe depends on the size of the reg file.
@Mark,
Something like this: http://itninja.com/question/ghost-8.0-on-lan1&mpage=1&key=vbs%2Cregistry㉇
could do the job in a single VBS file.
Regards, Nick
you just proved me wrong with this one. Have used this method a few times too (although, not with registry files).
Just thought, it would complicate things more, than use a single VB script file. But this maybe depends on the size of the reg file.
@Mark,
Something like this: http://itninja.com/question/ghost-8.0-on-lan1&mpage=1&key=vbs%2Cregistry㉇
could do the job in a single VBS file.
Regards, Nick
Posted by:
jmcfadyen
17 years ago
Posted by:
frodo
17 years ago
Posted by:
spartacus
17 years ago
ORIGINAL: frodo
the vendor msi removes the keys via a custom action and i cant pinpoint which one.
No disrepect intended to previous replies but given the scale of the task you are facing it may be worth a bit more perseverence trying to track down the vendor's custom action responsible for the issue.
Presumably the vendor's custom action is conditioned such that it only runs on uninstall (?) If so, could you not locate all the custom actions so conditioned and disable them all.
Then reinstate them one-by-one doing uninstall tests at each stage until you see the registry keys/values being removed. Once you have found the CA responsible, you could then remove/disable it permanently.
I know it's likely to be a tedious task, but it could be worth the effort in the long run .. [;)]
Regards,
Spartacus
Posted by:
AngelD
17 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.