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

Posted by

Since we upgraded to Veeam V10 our rest API Calls from our PowerShell runbooks stopped working. After a lot of Googling and checking the API for changes I found out that the new Veeam API does not support request from the old weak TLS Requests. The PowerShell version / .net I am using on the runbook server standard using older TLS versions, don’t know the exact case.

But one thing I do know is how to solve this 😊.
Just force PowerShell to use TLS1.2, by adding this one-liner on top of your script.

Leave a Reply

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