Quick tip: Invoke-WebRequest and SSL/TLS

If you have ever tried using Invoke-WebRequest to get a webpage using SSL, you will most likely have seen the following error message:

Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.

The simple “fix” for this problem is to tell PowerShell to use TLS 1.2 instead of the default 1.0:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri "https://some.site.com"