如何在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 红包祝福语简短10字
18 周六早晨祝福语简短