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

It forms part 4 of an 18-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.

To delete data we do almost exactly the same as above, except we change the SQL query to perform a delete instead of an insert.

The last value we inserted has a primary key of ‘SampleReg’. To delete this row, we simply change the SQL statement:

'create a view of the query we want to execute
Dim sql : sql = "DELETE FROM `Registry` WHERE `Registry` = 'SampleReg'"

tipTip: Remember the golden rule of deleting and updating – always do it using the primary key! (The unique identifier for the row of data!)

 

Thanks for reading about deleting a registry value from an MSI database using VBScript.  Next you can find out how to update a registry value in an MSI database using VBScript.

Deleting a registry value from an MSI database
Comments have now been disabled. If you have a question to ask about this post please ask the community!