Force PowerShell to use TLS 1.2
Following best practice, we have been diabling TLS 1.0 and 1.1 from our servers. One of the few issues that we ran into was making TLS 1.2 connections with PowerShell. It seems PowerShell uses TLS 1.0 by default. Errors like below will start to show up.
How do you force Powershell to use the newer and more secure TLS 1.2? With some simple .Net magic. A simple single line set your current session to use the correct TLS.
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
Nice. And to find out what versions of TLS powershell Supports. Use System.Net.SecurityProtocolType
[enum]::GetNames([System.Net.SecurityProtocolType])
As you can see. TLS 1.3 is not supported yet.
Enjoy
Jeff