It turns out I need to execute another view (an update view) once I've found the record I'm interested in. Here is the code in all its glory for those who are curious. Note: This is written as a PowerShell script.
# $packages is a collection of strings representing the path to the MSI packages to update # $actionPattern is a wildcard pattern for matching the actions I'm interested in updating $PSScriptRoot = Split-Path -Path $MyInvocation.MyCommand.Path $dtfAssembly = Join-Path -Path $PSScriptRoot -ChildPath Microsoft.Deployment.WindowsInstaller.dll Add-Type -Path $dtfAssembly foreach ($filePath in $packages) { $databaseInfo = @{ TypeName = 'Microsoft.Deployment.WindowsInstaller.Database' ArgumentList = @( $filePath, [Microsoft.Deployment.WindowsInstaller.DatabaseOpenMode]::Direct ) } $database = New-Object @databaseInfo try { $searchQuery = $database.Tables['InstallExecuteSequence'].SqlSelectString $searchView = $database.OpenView($searchQuery) try { $searchView.Execute() for ( $record = $searchView.Fetch() ; $record -ne $null ; $record = $searchView.Fetch() ) { try { $action = $record.GetString('Action') if ($action -like $actionPattern) { $updateQuery = "UPDATE InstallExecuteSequence SET Condition = 'FALSE' WHERE Action = '${action}'" $updateView = $database.OpenView($updateQuery) try { $updateView.Execute() } finally { if ($updateView) { $updateView.Close() } } } } finally { $record.Close() } } } finally { if ($searchView) { $searchView.Close() } } $database.Commit() } finally { if ($database) { $database.Close() } } } Edwin G. Castro Software Developer - Staff Electronic Banking Services Fiserv Office: 503-746-0643 Fax: 503-617-0291 www.fiserv.com Please consider the environment before printing this e-mail > -----Original Message----- > From: Castro, Edwin G. (Hillsboro) [mailto:edwin.cas...@fiserv.com] > Sent: Monday, January 17, 2011 5:06 PM > To: General discussion for Windows Installer XML toolset. (wix- > us...@lists.sourceforge.net) > Subject: [WiX-users] Update InstallExecuteSequence Condition > Programmatically using DTF > > I’d like to write a program using DTF to open up a MSI package and > programmatically update some Conditions in the InstallExecuteSequence > table. This program be used to update MSI packages before installation. > Here’s some pseudo code for what I have so far: > > using (database = new Database(filePath, DatabaseOpenMode.Transact)) { > query = database.Tables["InstallExecuteSequence"].SqlSelectString > using (view = database.OpenView(query)) > { > while (record = view.Fetch()) > { > try > { > action = record.GetString("Action") > if (action is the action I want) > { > record.SetString("Condition", "new condition") > } > } > finally > { > record.Close() > } > } > } > database.Commit() > } > > I’m trying to implement this as a PowerShell script so my script doesn’t look > exactly like the pseudo code above. > > Is this going in the correct direction? I have a feeling that this isn’t > quite right > but I don’t know exactly what the missing piece is. > > Edwin G. Castro > Software Developer - Staff > Electronic Banking Services > Fiserv > Office: 503-746-0643 > Fax: 503-617-0291 > www.fiserv.com > P Please consider the environment before printing this e-mail > > > ------------------------------------------------------------------------------ > Protect Your Site and Customers from Malware Attacks Learn about various > malware tactics and how to avoid them. Understand malware threats, the > impact they can have on your business, and how you can protect your > company and customers by using code signing. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users