John John
John John

Reputation: 1

Enable TLS 1.2 on windows 10 64-bit + check if it is enabled or not

I want to run my PS1 files which connect to SharePoint online, the script keeps raising this error:-

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

now based on my readings that one reason for getting this error is that we need to enable TLS 1.2 on the client , as mentioned in this link @ https://learn.microsoft.com/en-us/mem/configmgr/core/plan-design/security/enable-tls-1-2-client ..

so i tried the steps mentioned in the link, where i added the register key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp but i can not find this HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp as there is no folder named WinHttp under internet settings... Can anyone advice?on this , why my windows 10 does not have the second registry path + are there other steps that i need to do to enable TLS 1.2 ?

Thanks

Upvotes: 1

Views: 2610

Answers (1)

Sage Pourpre
Sage Pourpre

Reputation: 10333

To ensure TLS 1.2 is used, add this anywhere before the first request you make.

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

Vscode snippet

If you are using vscode, here is the code for a snippet, so you can quickly add this in your code whenever needed.

    "tls12": {
        "prefix": "tls12",
        "body": "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12"
    },

Upvotes: 3

Related Questions