opscode/cookbooks — pull request #403 by madhurranjan (2012-06-06 14:56:14+00:00)
Title: Powershell errors should be displayed

Hi,

When running powershell scripts with chef using the powershell cookbook, by default, even when there are errors in the powershell script, the errors are not displayed. "erroractionpreference" is a powershell way of handingl errors. It has 4 values - SilentlyContinue ,Continue, Stop, Inquire. The "stop" value has to be explicitly set up in powershell in order to throw errors to the console with the right exit code and stack trace.

We found it to be a big problem when running our scripts with powershell resource in chef and this helped us a lot as it threw the exact error on console.

More information can be found here -> http://blogs.technet.com/b/heyscriptingguy/archive/2010/03/08/hey-scripting-guy-march-8-2010.aspx

Madhurranjan