Error Action Preference

Sep 28, 2010 at 3:51 PM

I am using the older tfs deployer for TFS 2008.

Currently whenever I encounter an error. The email i recieve only contains the error and the script halts on that error, also none of the write-ouput text is included in the email, just the error. I would really like to see all the output including the error so i get a better idea of where and when the problem occurred.The other problem is that there are other tasks in the script that need to occur regardless if an error occurs. Is there a way to set the erroraction preference to continue?

I have already tried forcing$erroractionpreference = continue but that option in the powershell script but it seems to nothing. Currently the script I am using runs in powershell v1. I was thinking I might be able to work around the above mentioned issues with Powershell v2 try and catch blocks but i have a feeling that won't help. I will update this post with my findings on that.

But in the meantime, if someone has some advice or insight on this issue I would be grateful.

Thanks.

Coordinator
Sep 29, 2010 at 1:04 AM

Hi,

The latest source in the Branches/LegacyTfs2008 folder will ensure all script output preceeding an error is captured and reported in the email.

To enable a script to continue running on error, specifying the "-ErrorAction SilentlyContinue" switch on the offending command should work. Using a PSv1 trap block or a PSv2 try-catch block should work too.

Regards,

Jason