title: PowerShell: return error exit code if not match a string
body: <p>I found that </p>
  
  <p><code>$(Invoke-Expression hostname) -eq 'mycomputername'</code></p>
  
  <p>Whether it is matched or not, the exitcode must be 0
  this behavior is different from linux ,i.e, if not match error code exit 1</p>
  
  <p>Is there any short command in PowerShell that can return error exit code if doesn't match the string?</p>