Edit SummaryInformation with PowerShell
Hi everyone,
does someone know how to read and change the SummaryInformation in a MSI package with PowerShell?
I am having already trouble with opening the information but please see below my code:
Thanks
Stephan
Clear-Host $installer = New-Object -ComObject WindowsInstaller.Installer $WorkingDir = "C:\Users\Desktop\" $MSI_file2 = "Sync.ism" $scriptpath = Split-Path -parent $MyInvocation.MyCommand.Definition $msiOpenDatabaseModeReadOnly = 0 $msiOpenDatabaseModeTransact = 1 $msiViewModifyUpdate = 2 $msiViewModifyReplace = 4 $msiViewModifyDelete = 6 $msiTransformErrorNone = 0 $msiTransformValidationNone = 0 function Invoke-Method ($Object, $MethodName, $ArgumentList) { return $Object.GetType().InvokeMember($MethodName, 'Public, Instance, InvokeMethod', $null, $Object, $ArgumentList) } function Get-Property ($Object, $PropertyName, [object[]]$ArgumentList) { return $Object.GetType().InvokeMember($PropertyName, 'Public, Instance, GetProperty', $null, $Object, $ArgumentList) } if ($database2 -ne $null){ [Runtime.InteropServices.Marshal]::FinalReleaseComObject($database2) } if ($summary -ne $null){ [Runtime.InteropServices.Marshal]::FinalReleaseComObject($summary) } $database2 = $Installer.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $Null, $Installer, @(($WorkingDir + $MSI_file2), 0)) $summary = $database2.GetType().InvokeMember("SummaryInformation", "GetProperty", $Null, $database2, $Null, 1) #$database2.GetType().GetProperty $summary.GetType().InvokeMember("Persist", "InvokeMethod", $Null, $summary, $null) write-host $test
Answers (3)
I've only a vbs script..
MSIDB = open ISM
' Modify the Summary Information Stream
Set sumInfo = MSIDB.SummaryInformation(4)
sumInfo.Property(2) = ProductName' SIS Title
sumInfo.Property(3) = ProductName & " (v" & ProductVersion & ")"' SIS Subject
sumInfo.Property(4) = WFM_Company & " - " & PackagingTeam' SIS Author
sumInfo.Property(6) = GenericComment' SIS Comments
sumInfo.Persist
Set sumInfo = Nothing
' Commit the changes to the new database
MSIDB.Commit
Hi,
yes, I found the same in the MSI vbs script collection but all my script is already powershell.
I use it to change values in the property and registry table and now would like also modify the schema verison of the MSI/ISM.
When I try it this way: $summary = $database2.GetType().InvokeMember("SummaryInformation", "GetProperty", $Null, $database2, 14)