Kae Travis

Updating a registry value in an MSI database

This blog entry provides an example of updating a registry value in an MSI database using VBScript. It follows on from the previous blog post which provided a tutorial on deleting a registry value from an MSI database using VBScript.

It forms part 5 of an 17-part series that explores how to use VBScript to manipulate MSI relational databases using the Windows Installer API. Throughout this series of tutorials, we identify the common issues that we encounter and the best practises that we use to overcome them.

Let’s update the key we inserted earlier and change:

HKLM\Software\AlkaneTest\testName testValue

to

HKLM\Software\AlkaneTest\testName NewTestValue

Similarly to the ‘Insert’ and ‘Delete’ excerpts, we can just change the SQL query and commit the changes:

Dim sql : sql = "UPDATE `Registry` SET `Value` = 'newTestValue' WHERE `Registry` = 'SampleReg'"

tip Tip: Remember that you cannot modify a primary key value. In these instances, you’ll need to use the Modify method.

 

Thanks for reading about updating a registry value inside an MSI database using VBScript. Next you can find out how to update a registry value in an MSI database using the Modify method and VBScript.

Updating a registry value in an MSI database
Updating a registry value in an MSI database

Leave a Reply