{"action":"created","issue":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-powershell/issues/72","labels_url":"https://api.github.com/repos/puppetlabs/puppetlabs-powershell/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/puppetlabs/puppetlabs-powershell/issues/72/comments","events_url":"https://api.github.com/repos/puppetlabs/puppetlabs-powershell/issues/72/events","html_url":"https://github.com/puppetlabs/puppetlabs-powershell/issues/72","id":126707670,"number":72,"title":"Cant get unless exit codes to work","user":{"login":"tek0011","id":1085020,"avatar_url":"https://avatars.githubusercontent.com/u/1085020?v=3","gravatar_id":"","url":"https://api.github.com/users/tek0011","html_url":"https://github.com/tek0011","followers_url":"https://api.github.com/users/tek0011/followers","following_url":"https://api.github.com/users/tek0011/following{/other_user}","gists_url":"https://api.github.com/users/tek0011/gists{/gist_id}","starred_url":"https://api.github.com/users/tek0011/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tek0011/subscriptions","organizations_url":"https://api.github.com/users/tek0011/orgs","repos_url":"https://api.github.com/users/tek0011/repos","events_url":"https://api.github.com/users/tek0011/events{/privacy}","received_events_url":"https://api.github.com/users/tek0011/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-14T17:37:04Z","updated_at":"2016-01-14T18:28:06Z","closed_at":null,"body":"I am trying something like:\r\n\r\n```\r\nexec { 'download dsm client default':\r\n  command =>  'Write-Host \"hello\"',\r\n  path     => $::path,\r\n  provider => powershell,\r\n  timeout  => 500,\r\n  logoutput => true,\r\n  unless   => 'if ((get-item \"C:/Windows/System32/notepad.exe\").Name -eq \"notepad.exe\") { exit 0 }'\r\n}\r\n```\r\n\r\nHowever, it does not matter what I put in to the -eq.  If I leave notepad.exe in -eq and change { exit 0} to { Write-Host \"hello\" }  - it indeed works.  Prints hello when -eq is \"notepad.exe\" and doesn't print if -eq doesnt equal \"notepad.exe\"\r\n\r\nYet, when I incorporate this in to puppet, the cmd will not get excuted, regardless of what is in the -eq.  \r\n\r\nAny ideas whats going on here?  Ive tried forcing exit codes of 1, with else statements as well.\r\nCan't seem to get it to work correctly."},"comment":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-powershell/issues/comments/171731204","html_url":"https://github.com/puppetlabs/puppetlabs-powershell/issues/72#issuecomment-171731204","issue_url":"https://api.github.com/repos/puppetlabs/puppetlabs-powershell/issues/72","id":171731204,"user":{"login":"tek0011","id":1085020,"avatar_url":"https://avatars.githubusercontent.com/u/1085020?v=3","gravatar_id":"","url":"https://api.github.com/users/tek0011","html_url":"https://github.com/tek0011","followers_url":"https://api.github.com/users/tek0011/followers","following_url":"https://api.github.com/users/tek0011/following{/other_user}","gists_url":"https://api.github.com/users/tek0011/gists{/gist_id}","starred_url":"https://api.github.com/users/tek0011/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tek0011/subscriptions","organizations_url":"https://api.github.com/users/tek0011/orgs","repos_url":"https://api.github.com/users/tek0011/repos","events_url":"https://api.github.com/users/tek0011/events{/privacy}","received_events_url":"https://api.github.com/users/tek0011/received_events","type":"User","site_admin":false},"created_at":"2016-01-14T18:28:06Z","updated_at":"2016-01-14T18:28:06Z","body":"Also the syntax above might be incorrect.  But I assure you Ive tried some 50+ ways.\r\n\r\n```\r\n(${(get-item \"C:/Windows/System32/notepad.exe\").Name -eq \"derp\")}) { exit 1 } else { exit 0 }\r\n```\r\n\r\nwould likely be more correct?\r\n\r\neither or, no go :("}}