Write to the Windows Installer Binary Stream using Powershell

Here’s a small chunk of code from a recent request asking how to write to the Windows Installer binary stream using Powershell: $msiOpenDatabaseModeReadOnly = 0 $msiOpenDatabaseModeTransact = 1 $windowsInstaller = New-Object -ComObject windowsInstaller.Installer $pathToMSI = “C:\Users\xxxx\Desktop\AlkaneExample.msi” $database2 = $windowsInstaller.GetType().InvokeMember(“OpenDatabase”, “InvokeMethod”, … Continue reading

Query a Windows Installer (MSI) using Powershell

This is just a quick example of how we can query a Windows Installer using Powershell code: $msiOpenDatabaseModeReadOnly = 0 $msiOpenDatabaseModeTransact = 1 $windowsInstaller = New-Object -ComObject windowsInstaller.Installer $pathToMSI = “C:\Users\xxxx\Desktop\AlkaneExample.msi” $database = $windowsInstaller.GetType().InvokeMember(“OpenDatabase”, “InvokeMethod”, $null, $windowsInstaller, @($pathToMSI, $msiOpenDatabaseModeReadOnly)) $query … Continue reading