mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-08-20 17:18:27 +02:00
13 lines
652 B
PowerShell
13 lines
652 B
PowerShell
# From https://stackoverflow.com/a/31919297
|
|
|
|
$path = $args[0]
|
|
|
|
$comObjWI = New-Object -ComObject WindowsInstaller.Installer
|
|
$MSIDatabase = $comObjWI.GetType().InvokeMember("OpenDatabase","InvokeMethod",$Null,$comObjWI,@($Path,0))
|
|
$Query = "SELECT Value FROM Property WHERE Property = 'ProductCode'"
|
|
$View = $MSIDatabase.GetType().InvokeMember("OpenView","InvokeMethod",$null,$MSIDatabase,($Query))
|
|
$View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null)
|
|
$Record = $View.GetType().InvokeMember("Fetch","InvokeMethod",$null,$View,$null)
|
|
$Value = $Record.GetType().InvokeMember("StringData","GetProperty",$null,$Record,1)
|
|
|
|
echo $Value |