title: How to return error code 1 on error from PowerShell?
body: <p>Can you give an example how to return error code 1 on error using PowerShell?</p>
  
  <p>For example handling this situation:</p>
  
  <pre><code>if ($serviceUserName) {
    cmd /c $serviceBinaryFinalPath install -username:$serviceUserName -password:$serviceUserPassword -servicename:"$ServiceName" -displayname:"$serviceDisplayName" -description:"$serviceDescription"
  } else {
    cmd /c $serviceBinaryFinalPath install --localsystem -servicename:"$ServiceName" -displayname:"$serviceDisplayName" -description:"$serviceDescription"
  }
  </code></pre>