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 http://www.lgkfjgklfjg.com/search?q=blabla)
How can I prevent my script from quitting? I just want to catch the error, log it and continue.
Thanks.