/build/static/layout/Breadcrumb_cap_w.png

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

0 Comments   [ + ] Show comments

Answers (3)

Posted by: Glytzhkof 6 years ago
Senior Yellow Belt
0

Maybe have a look here: https://stackoverflow.com/questions/53199158/set-summaryinformation-in-an-msi-using-powershell

Posted by: jaybee96 11 years ago
Red Belt
0

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

 
Posted by: mac-duff 11 years ago
Second Degree Blue Belt
0

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)

I get this error:
InvokeMember : Exception calling "InvokeMember" with "5" argument(s): "SummaryInformation,UpdateCount"
 
At C:\Users\Desktop\schema.ps1:34 char:45
+ $summary = $database2.GetType().InvokeMember <<<< ("SummaryInformation", "GetProperty", $Null, $database2, 14)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodTargetInvocation

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ