Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send

Scenario:  You receive the following error when you attempt to Invoke-WebRequest from PowerShell:
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.

Solution: Run the following in PowerShell to make sure it uses TLS1.2

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


Leave a comment