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"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s