1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| $MsiFilePath = "${PSScriptRoot}\7z2201-x64.msi"
$Query = "UPDATE Property SET Property.Value='9.8.7' WHERE Property.Property='ProductVersion'"
$WindowsInstaller = New-Object -ComObject WindowsInstaller.Installer
$Database = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $WindowsInstaller, @($MsiFilePath, 1))
$View = $Database.GetType().InvokeMember("OpenView", "InvokeMethod", $Null, $Database, ($Query))
$View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null)
$View.GetType().InvokeMember("Close", "InvokeMethod", $Null, $View, $Null)
[void][System.Runtime.Interopservices.Marshal]::ReleaseComObject($View)
$Database.GetType().InvokeMember("Commit", "InvokeMethod", $Null, $Database, $Null)
[void][System.Runtime.Interopservices.Marshal]::ReleaseComObject($Database) |
Partager