| I'm eagerly following this issue as PowerShell is big part of our Jenkins use. The "implement a first-class FileMonitoringTask that bypasses *.bat entirely" mentioned above by Jesse is something I am eager and interested in evaluating/experiencing/testing. However as we are currently limited to Windows traditional command execution (and its binary feedback) via the bat mechanism I can speak to gotchas as it pertains to powershell.exe and success/failure behaviors. Both for Andrzej's concern above and others who may wind their way here. I've been using the bat step for a little while now and the traditional freestyle PowerShell plugin for some time. The biggest thing to keep in mind are PowerShell's idea of a terminating errors and non-terminating errors. Without extra effort PowerShell non-terminating errors are not going to cause Jenkins nor the Windows command execution that marries the two to be recognized as a "failure". Understanding your code and making sure that you generate terminating errors where needed to get that "failure" surfaced in Jenkins is critical. Additionally knowing when and how the PowerShell.exe interpreter registers the failure or success of native exe's vs cmdlets. Check the following URLs for clarity on that. Bottom line the "-ErrorAction Stop" builtin parameter to cmdlets is your friend here, along with try/catch/finally. And also making sure you understand "$LastExitCode vs $?", the builtin PowerShell variables and how you exit your script in the context of Jenkins. https://blogs.technet.microsoft.com/heyscriptingguy/2015/09/16/understanding-non-terminating-errors-in-powershell/ http://stackoverflow.com/questions/10666035/difference-between-and-lastexitcode-in-powershell |