Relative Content

Tag Archive for powershellgpo

PowerShell return a custom error message on non-terminating error based on the error type

I have a PowerShell script that I am working on and I am trying to figure out how to have it catch the non-terminating error and return a custom error message instead of the standard error message text. I am specifically concerned with 2 different errors that I expect to see based on parameters and how I can have the script return a custom error text depending on which error it is instead of returning the long system error.