Created
October 8, 2018 10:24
-
-
Save bjh1977/c36be228c6865dd414df13a8703e3cb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$path = "\\path\to\file\msoidcli_64bit.msi" | |
$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) | |
$Value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment