You can try using Shell.Application COM object to extract the metadata, I don't know of a way to extract just Comments, but there is a way to extract all the metadata from it into an ordered dictionary.
# using PowerShell msi for the example
$path = 'path\to\PowerShell-7.5.0-win-x86.msi'
$shell = New-Object -ComObject Shell.Application
$dir = $shell.NameSpace([System.IO.Path]::GetDirectoryName($path))
$item = $dir.ParseName([System.IO.Path]::GetFileName($path))
$metadata = [ordered]@{}
for ($id = $nullCounter = 0; $nullCounter -lt 10; $id++) {
$key = $dir.GetDetailsOf($null, $id)
$value = $dir.GetDetailsOf($item, $id)
if ($key -and $value) {
$metadata[$key] = $value
$nullCounter = 0
continue
}
if ($id -lt 320) { continue }
$nullCounter++
}
Then from here you should have all the file metadata in $metadata, and assuming it had a Comments key, you could do:
$metadata['Name'] # PowerShell-7.5.0-win-x86.msi
$metadata['Comments'] # PowerShell for every system
$metadata['Title'] # Installation Database
$metadata['Subject'] # PowerShell package
$metadata['Authors'] # Microsoft Corporation