Error Handling on Invoke-restmethod

by Sep 29, 2013

I've been searching for this for some time now.

I'm trying to catch webexceptions on invoke-restmethod. When I call it with an invalid URL it bails out with an exception, regardless of -erroraction SilentlyContinue.

$response = (invoke-restmethod

How can I prevent my script from quitting? I just want to catch the error, log it and continue.