本文介绍了Powershell 将安全协议设置为 TLS 1.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用此代码
$WebClient = New-Object system.net.webclient
$WebClient.credentials = New-Object System.Net.NetworkCredential -ArgumentList $username, $password
$WebClient.Proxy = $null
$WebClient.Headers.Add("COperation","MethodCall")
$WebClient.Headers.Add("CMethod", "EnumerateInstances")
$WebClient.Headers.Add("CObject", $NameSpace)
$WebClient.Headers.Add("Content-Type", "application/xml")
$System= $WebClient.UploadString($Url, "POST", $EnumMessage)
这很好用.我想要做的是将安全协议设置为 Tls1.2 或 Tls1.1.请帮忙.
This works well. What I want to do is that set the Security Protocol to Tls1.2 or Tls1.1. Please help.
推荐答案
设置这个应该会改变协议:
setting this should change the protocol :
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
PS : 在 powershell v5 中签入
PS : checked in powershell v5
设置多个安全协议:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls11 -bor [System.Net.SecurityProtocolType]::Tls12;
这篇关于Powershell 将安全协议设置为 TLS 1.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!