title: PowerShell Capture Write-Host output
body: <p>I am having to run a Microsoft cmdlet, and the important bit of information is written to console using a Write-Host line within the cmdlet.</p>
  
  <p>It is NOT returned, so I cannot do $result = Commandlet ...
  A different value is returned that is not of use to me, what I actually need is printed to console within the commandlet is there anyway I can 'sniff' or 'scrape' the console to get the information I want?</p>
  
  <pre><code>$result = Test-Cluser
  </code></pre>
  
  <p>Test-Cluster will print stuff like: 'HadUnselectedTests', 'ClusterConditionallyApproved', etc.
  But the value it returns in the path to the .htm report file.
  And the .htm report file does not contain one of those status codes unfortunately so I cannot just parse the .htm file for it either.</p>
  
  <p>Any suggestions?</p>