title: Extracting Binary Data from MSI
body: <p>I'm trying to extract the binary data from an MSI file using Powershell.
  I can get any other piece of data, but I can't seem to extract the binary information.</p>
  
  <pre><code>$Query = "SELECT Data FROM Binary WHERE Name = 'bannrbmp'"
  $View = $Database.GetType().InvokeMember("OpenView", "InvokeMethod", $null, $Database, ($Query))
  $View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null)
  $Record = $View.GetType().InvokeMember("Fetch", "InvokeMethod", $null, $View, $null)
  
  $BinaryData = $Record.GetType().InvokeMember("StringData", "GetProperty", $null, $Record, 1)
  </code></pre>
  
  <p>It breaks on the final line, which leads me to believe that an issue exists with "StringData", but I could be way off target. Here is what the table looks like when opened up in Orca.
  <a href="https://i.stack.imgur.com/dC91Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dC91Y.png" alt="enter image description here"></a></p>
  
  <p>This code will successfully complete when extracting textual data as below.</p>
  
  <pre><code>$Query = "SELECT Component FROM FeatureComponents WHERE Feature = 'OrcaHelp'"
  $View = $Database.GetType().InvokeMember("OpenView", "InvokeMethod", $null, $Database, ($Query))
  $View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null)
  $Record = $View.GetType().InvokeMember("Fetch", "InvokeMethod", $null, $View, $null)
  
  $Data = $Record.GetType().InvokeMember("StringData", "GetProperty", $null, $Record, 1)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/HyfzI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HyfzI.png" alt="enter image description here"></a></p>
  
  <p>I couldn't seem to find anything on the web, if anyone is able to help it would be greatly appreciated.</p>