PowerShell function to suppress HTTPS self-signed certificate errors

I’ve been working frequently with the Invoke-WebRequest and Invoke-RestMethod functions recently against my SolarWinds Orion infrastructure.  I’d normally use the Swis Snapin, but instead wanted to get a little more experience with JSON and XML.

Now, when I try to make that call to port 17778 on any machine except the Orion server itself, I get a certificate error.  So, I can either install a self-signed certificate to a different machine (bad idea) or temporarily allow the self-signed certificates (better).

I found that I wasn’t the only person who had this issue and PoSH Code #624 shows the core of the function that I crafted.  That article was the seed for this function.  I just dot-include this script and call the function for any other scripts that make calls against using the above functions.


Leave a Comment