i want to get the MSI Summary Information with PowerShell i found several scripts and code snippets for opening the "normal" Tables of MSI.
So here is my question, how can open the Summary Information with PowerShell?
I attach some code snippets you might find useful.
My Code for getting the Summary Information which doesn't work!
function Get-SummaryInformation ( [IO.FileInfo] $FilePath ){
try {
$windowsInstaller = New-Object -com WindowsInstaller.Installer
$database = $windowsInstaller.GetType().InvokeMember(“OpenDatabase”, “InvokeMethod”, $Null,
$windowsInstaller, @($FilePath.FullName, 0))
$summary = $database.GetType().InvokeMember(“SummaryInformation”, “Invoke-Method”, $Null, $database, ([2]))
$MSI_Summary[1]=$summary.text
}
catch {
throw "ERROR - " + $_
}
}
Code for gettin Normal MSI Tables
function Get-MsiProductCode ( [IO.FileInfo] $FilePath ) {
try {
$windowsInstaller = New-Object -com WindowsInstaller.Installer
$database = $windowsInstaller.GetType().InvokeMember(“OpenDatabase”, “InvokeMethod”, $Null, $windowsInstaller, @($FilePath.FullName, 0))
$q = "SELECT `Value` FROM `Property` WHERE `Property` = 'ProductCode'"
$View = $database.GetType().InvokeMember(“OpenView”, “InvokeMethod”, $Null, $database, ($q))
$View.GetType().InvokeMember(“Execute”, “InvokeMethod”, $Null, $View, $Null)
$record = $View.GetType().InvokeMember(“Fetch”, “InvokeMethod”, $Null, $View, $Null)
$global:ProductCode = $record.GetType().InvokeMember(“StringData”, “GetProperty”, $Null, $record, 1)
} catch {
throw "Failed to get MSI file version the error was: {0}." -f $_
}
}