title: Powershell : How do I capture Success and Failure of call to command?
body: <pre><code>$roledetails = ./btp get security/role-collection `&quot;$Role`&quot; | Out-String
  </code></pre>
  <p>I have above command in PowerShell which executes the executable btp.exe using parameter provided. If it was successful, it provides &quot;OK&quot; and returns the results. I can capture result using $roledetails upon successful but not able to capture &quot;OK&quot; value which is printed on PpowerShell Command line.</p>
  <p>If it is failure it prints &quot;FAILED&quot; value on screen and returns blank value in $roleDetails.</p>
  <p>How do I capture &quot;OK&quot; OR &quot;FAILED&quot; system message ?</p>
  <p>When it is</p>