HomePlatform & securityTLS and PowerShell

TLS and PowerShell

Force PowerShell to use TLS 1.2 so your scripts can connect to the Interact APIs.

Overview

In December 2017, Interact disabled support for TLS 1.0. TLS 1.0 is an old technology with several vulnerabilities, so support was removed and connections now require TLS 1.1 or TLS 1.2.

For most people this had no effect. However, customers who use PowerShell to automate tasks such as General Profile Sources for XML imports, or profile pictures, see an error. By default, PowerShell always tries to connect using TLS 1.0, so any attempt to connect results in the following error:

Warning: The underlying connection was closed: An unexpected error occurred on a send.

Fix the error

The fix requires a single line of code that instructs PowerShell to use TLS 1.2. Add it to any PowerShell script that connects to the Interact APIs, before any network communication is required. The top of the script is usually fine.

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Section: Platform & security