title: How can I get powershell exception descriptions into a string?
body: <p>I want to have access to the same message that Powershell prints when you send an error record to the output stream</p>
  
  <p>Example:</p>
  
  <blockquote>
    <p>This is the exception message At
    C:\Documents and
    Settings\BillBillington\Desktop\psTest\exThrower.ps1:1
    char:6
    + throw &lt;&lt;&lt;&lt;  (New-Object ArgumentException("This is the
    exception"));
        + CategoryInfo          : OperationStopped: (:) [],
    ArgumentException
        + FullyQualifiedErrorId : This is the exception</p>
  </blockquote>
  
  <p>I when a get the last ErrorRecord by doing $Error[0] I can't seem to figure out how to get this information in a simple way</p>
  
  <p>I found this 'Resolve-Error' function from the community extensions <a href="http://blogs.msdn.com/b/powershell/archive/2006/12/07/resolve-error.aspx" rel="noreferrer" title="here">here</a> which does roughly what I want but it prints a huge semi-formatted list of stuff I don't need that I have to then strip</p>
  
  <p>Is there way of accessing the message that Powershell uses or failing that a simpler way of getting hash of the values I care about so I can put them into a string in a format of my choosing?</p>