Powershell – Enable TLS1.2 for Windows 7, 8, Server 2012 R2 or older
I prefix this line on all PowerShell scripts that I know will be running on older PCs. Needed for Send-MailMessage, Invoke-WebRequest, Invoke-RestMethod, and probably more.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12