如何在PowerShell中更改TLS版本?
当使用URI命令(例如Invoke-WebRequest或Invoke-Restmethod命令)和打包命令(例如Find-Package或Install-Package)时,称为TLS的传输层安全性是非常重要的部分,因为它们在Internet上交互并且PowerShell需要TLS1.2版本为了那个原因。
当使用较低的TLS版本时,我们可能会出现以下错误。
WARNING: Unable to download the list of available providers. Check your internet connection. WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'. Find-Package : No match was found for the specified search criteria and package name
要解决以上错误,我们需要更改TLS版本。要检查现有的TLS版本,我们可以使用以下命令,
PS C:\> [Net.ServicePointManager]::SecurityProtocol Ssl3, Tls
要将TLS版本更改为1.2,可以使用以下命令。
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
热门推荐
10 对患者生日祝福语简短
11 结婚祝福语简短装备
12 周岁祝福语学生文案简短
13 订婚领证祝福语简短精辟
14 导师获奖祝福语大全简短
15 新婚购房祝福语简短精辟
16 牛年祝福语简短的爱人
17 送芒果的祝福语简短
18 送给学长毕业祝福语简短