etc/parser/test_wixsetup.ps1
using namespace System.IO using namespace System.Text function Test-WixSetup { [CmdletBinding()] param( [Parameter(Mandatory)] [ValidateScript({!!($script:file = Convert-Path -Path $_ -ErrorAction 0)})] [ValidateNotNullOrEmpty()] [String]$Path ) end { (Get-PeHeaders -Path ($Path = $file) | Out-String | Select-String '\.wixburn').Matches.Value ? $( $xml = (Get-PeManifest -Path $Path)[2] if (!(Compare-Object (Format-Hex -InputObject $xml ).Bytes[0..2] ([Encoding]::UTF8.GetPreamble()))) { $xml = $xml.Substring(1, $xml.Length - 1) } ([xml]$xml).assembly.description ) : 'Not a Wix installer' } } |