function Get-MsiCodes { param([string]$Path) $installer = New-Object -ComObject WindowsInstaller.Installer $db = $installer.GetType().InvokeMember('OpenDatabase','InvokeMethod',$null,$installer,@($Path,0)) $props = @{} foreach ($p in 'ProductCode','UpgradeCode','ProductVersion','ProductName') { $view = $db.GetType().InvokeMember('OpenView','InvokeMethod',$null,$db, @("SELECT Value FROM Property WHERE Property='$p'")) $view.GetType().InvokeMember('Execute','InvokeMethod',$null,$view,$null) $rec = $view.GetType().InvokeMember('Fetch','InvokeMethod',$null,$view,$null) if ($rec) { $props[$p] = $rec.GetType().InvokeMember('StringData','GetProperty',$null,$rec,1) } } [PSCustomObject]$props } Get-MsiCodes 'C:\build\mis-agent-1.2.0.msi'