{"action":"created","issue":{"url":"https://api.github.com/repos/masterzen/winrm/issues/23","labels_url":"https://api.github.com/repos/masterzen/winrm/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/masterzen/winrm/issues/23/comments","events_url":"https://api.github.com/repos/masterzen/winrm/issues/23/events","html_url":"https://github.com/masterzen/winrm/issues/23","id":64684604,"number":23,"title":"not respecting -Wait or exit codes of powershell scripts","user":{"login":"levilovelock","id":1069252,"avatar_url":"https://avatars.githubusercontent.com/u/1069252?v=3","gravatar_id":"","url":"https://api.github.com/users/levilovelock","html_url":"https://github.com/levilovelock","followers_url":"https://api.github.com/users/levilovelock/followers","following_url":"https://api.github.com/users/levilovelock/following{/other_user}","gists_url":"https://api.github.com/users/levilovelock/gists{/gist_id}","starred_url":"https://api.github.com/users/levilovelock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/levilovelock/subscriptions","organizations_url":"https://api.github.com/users/levilovelock/orgs","repos_url":"https://api.github.com/users/levilovelock/repos","events_url":"https://api.github.com/users/levilovelock/events{/privacy}","received_events_url":"https://api.github.com/users/levilovelock/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-27T03:27:37Z","updated_at":"2015-04-06T15:09:54Z","closed_at":null,"body":"If I have a script like:\r\n\r\n```\r\nStart-Process -FilePath \"powershell.exe\" -ArgumentList @(\"/c\", \"sleep\", \"5\") -Wait\r\nExit 1\r\n```\r\n\r\nAnd run it under the powershell provisioner, I see two errors. Firstly, the wait is not respected and also the return code is 0, so it passes.\r\n\r\nI get each of those behaviour when I invoke the command through the winrm binary . Not sure if you guys know if there's something I can add here to make it behave as I want?\r\n\r\nI should note that this works for blocking the script:\r\n\r\n```\r\n$p = Start-Process -FilePath \"powershell.exe\" -ArgumentList @(\"/c\", \"sleep\", \"5\") -Wait -PassThru\r\nwhile ($p.HasExited -ne \"True\") {\r\n  Start-Sleep -Milliseconds 500\r\n}\r\n```\r\n\r\nStill can't work around the exit status though!"},"comment":{"url":"https://api.github.com/repos/masterzen/winrm/issues/comments/90096202","html_url":"https://github.com/masterzen/winrm/issues/23#issuecomment-90096202","issue_url":"https://api.github.com/repos/masterzen/winrm/issues/23","id":90096202,"user":{"login":"hach-que","id":504826,"avatar_url":"https://avatars.githubusercontent.com/u/504826?v=3","gravatar_id":"","url":"https://api.github.com/users/hach-que","html_url":"https://github.com/hach-que","followers_url":"https://api.github.com/users/hach-que/followers","following_url":"https://api.github.com/users/hach-que/following{/other_user}","gists_url":"https://api.github.com/users/hach-que/gists{/gist_id}","starred_url":"https://api.github.com/users/hach-que/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hach-que/subscriptions","organizations_url":"https://api.github.com/users/hach-que/orgs","repos_url":"https://api.github.com/users/hach-que/repos","events_url":"https://api.github.com/users/hach-que/events{/privacy}","received_events_url":"https://api.github.com/users/hach-que/received_events","type":"User","site_admin":false},"created_at":"2015-04-06T15:09:54Z","updated_at":"2015-04-06T15:09:54Z","body":"Upon further testing, it doesn't look like this solves the problem, it just allows commands to run for longer (for some strange reason)."}}