![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Powershell TRAP for non-terminating errors Hi there, I have some questions about the powershell error handling for non- terminating errors. I'm writing a script for Exchange 2007 and want to trap Exchange specific exceptions like [Microsoft.Exchange.Management.Tasks.MachineNotClusteredException] and [Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException] The problem is that these are non-terminating errors and I cannot trap them using the trap [Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException] { ............................ } Script blocks. If I want to trap them I need to add the -ErrorAction Stop to my cmdlets. This however changes the Exception type to [System.Management.Automation.ActionPreferenceStopException], which prevents me from using different trap{} scriptblocks for my error handling within the same scope. This is driving me nuts. Is there any way to get the non-terminating errors trapped ???? Cheers & Thanks, Mark |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Powershell 2 startup Errors | PowerShell | |||
| PSH Guru needed ! : Trapping terminating errors | PowerShell | |||
| Wooly concepts? Terminating and non-terminating errors. | PowerShell | |||
| How to trap this error in PowerShell | PowerShell | |||
| Identifying errors in PowerShell - how? | PowerShell | |||