Powershell - Try Catch - Non Powershell Errors

133 views Asked by At

Is it possible to create a try-catch that catches a non-Powershell cmdlet error?

Example Error:

iperf3: error - unable to connect to server: Connection timed out

I want to catch that error and then try a different server for redundancy.

Thank you for the assist.

1

There are 1 answers

0
LosFla On

you can try to build your own powershell function and throw an error with "throw " but you have to identify the error on your own within the powershell function