DMason
04-02-2007, 01:58 PM
Can the Windows Installer object model be used to modify a currently installed product? For instance, I need to change the value of several public properties. I've hacked out a little bit of VbScript code that looks something like this:
Dim oInstaller
Dim oSession
Dim oDB
Dim oView
Dim oRecord
Set oInstaller = CreateObject("WindowsInstaller.Installer")
Set oSession = oInstaller.OpenProduct("{EA59C14D-8C3E-4462-85F8-F1F14019BFF8}") 'Product Code of installed product.
Set oDB = oSession.Database
Set oView = oDB.OpenView("SELECT * FROM Property")
oView.Execute()
Do
Set oRecord = oView.Fetch()
If oRecord Is Nothing Then Exit Do
If UCase(oRecord.StringData(1)) = "IS_SQLSERVER_DATABASE" Then
oRecord.StringData(1) = "NewDbName"
oView.Modify 4, oRecord
End If
Loop
oDB.Commit
Set oRecord = Nothing
Set oView = Nothing
Set oDB = Nothing
Set oSession = Nothing
Set oInstaller = Nothing
Dim oInstaller
Dim oSession
Dim oDB
Dim oView
Dim oRecord
Set oInstaller = CreateObject("WindowsInstaller.Installer")
Set oSession = oInstaller.OpenProduct("{EA59C14D-8C3E-4462-85F8-F1F14019BFF8}") 'Product Code of installed product.
Set oDB = oSession.Database
Set oView = oDB.OpenView("SELECT * FROM Property")
oView.Execute()
Do
Set oRecord = oView.Fetch()
If oRecord Is Nothing Then Exit Do
If UCase(oRecord.StringData(1)) = "IS_SQLSERVER_DATABASE" Then
oRecord.StringData(1) = "NewDbName"
oView.Modify 4, oRecord
End If
Loop
oDB.Commit
Set oRecord = Nothing
Set oView = Nothing
Set oDB = Nothing
Set oSession = Nothing
Set oInstaller = Nothing