Set TLS Version in PowerShell

It has been described lots of times before. It’s just for the records…

This code sets the used TLS version for secure HTTP connections to version 1.2

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Here are the valid values:

SystemDefault
Ssl3
Tls
Tls11
Tls12

The latests supported version depends on your .NET Framework. On Windows 10 20H2 the setting Tls13 will work too.

With this code you can list the valid values:

[Net.SecurityProtocolType]::GetNames([Net.SecurityProtocolType])

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.