title: Jenkins powershell plugin always builds successfully
body: <p>I'm using Jenkins PowerShell plugin to build a project. </p>
  
  <p>However, I found that Jenkins always considers my build successful no matter what I type inside <code>Windows PowerShell</code> command.</p>
  
  <p>Here's an example:</p>
  
  <p><a href="https://i.stack.imgur.com/IGy09.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IGy09.png" alt="enter image description here"></a></p>
  
  <p>As you can see, <code>asdf</code> isn't a legal command. Jenkins should give me <code>FAILURE</code> after the build.</p>
  
  <p>But the console output gives me:</p>
  
  <pre><code>Started by user admin
  Building in workspace C:\Users\Administrator\.jenkins\jobs\Test\workspace
  [workspace] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "&amp; 'C:\Users\ADMINI~1\AppData\Local\Temp\hudson2092642221832331776.ps1'"
  The term 'asdf' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  At C:\Users\ADMINI~1\AppData\Local\Temp\hudson2092642221832331776.ps1:1 char:5
  + asdf &lt;&lt;&lt;&lt; 
      + CategoryInfo          : ObjectNotFound: (asdf:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
  
  Finished: SUCCESS
  </code></pre>
  
  <p>I think the execution result of PowerShell should depend on <code>$lastexitcode</code>.</p>
  
  <p>Is this a bug of PowerShell plugin?</p>