When I try to use Invoke-WebRequest I\'m getting some weird error:
Invoke-WebRequest -Uri \"https://idp.safenames.com/\"
Invoke-WebRequest : Th
As BaconBits notes, .NET version > 4.5 uses SSLv3 and TLS 1.0 by default.
You can change this behavior by setting the SecurityProtocol policy with the ServicePointManager class:
PS C:\> $AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
PS C:\> [System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
PS C:\> (Invoke-WebRequest -Uri "https://idp.safenames.com/").StatusCode
200
This will apply to all requests in the AppDomain (so it only applies to the current instance of the host application).
There's a module on GitHub and in PSGallery that can manage these settings now:
Install-Module BetterTls -Scope CurrentUser
Import-Module BetterTls
Enable-Tls -Tls11 -Tls12