I have a two part question about editing an MSI with VBScript.
The below code will work with a static value (C:\users\x etc) to place into the MSI 'Property' table. However, if I use a predefined variable then it inserts the variable name as text into the MSI and not what that variable translated to. How do I get the
msi.OpenView
function to accept a variable for the value?The variable is created from a commandline argument.
strNewServerName = WScript.Arguments.Item(0) Set record = msiInstaller.CreateRecord(1) Set view = msi.OpenView("INSERT INTO `Property` (`Property`, `Value`) VALUES ('SERVERNAME', 'strNewServerName')") view.Execute record
The
view.Execute
will error unless the property/row in the MSI is empty. I have to take out all the fields I'm updating in the source MSI before I commit the new one for this to function. Is there a way of triggering themsi.OpenView("INSERT INTO...")
with an overwrite command for whatever is already in the row/table?