【问题标题】:How to download a file from an url using Powershell script and enforce tls 1.1如何使用 Powershell 脚本从 url 下载文件并执行 tls 1.1
【发布时间】:2016-07-13 22:04:31
【问题描述】:

我们正在从供应商网站下载一个文件,他们最近从 tls 1.0 升级到了 1.1。如何使用 Powershell 脚本下载文件并执行 tls 1.1 下面的代码在升级之前一直有效。请指教。

$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://www.contoso.com/file","C:\path\file")

【问题讨论】:

  • 请发布您在运行命令时收到的错误。
  • [System.Net.ServicePointManager]::SecurityProtocol = 'Tls11'
  • 完美。感谢您的快速回复。

标签: windows powershell ssl tls1.2


【解决方案1】:

添加这个解决了我的问题。谢谢杰森。

[System.Net.ServicePointManager]::SecurityProtocol = 'Tls11'

【讨论】:

  • 作为属性的值,使用远程主机所需的任何协议版本(即'Tls12')您可以通过检索证书获取主机版本:openssl s_client -connect {HOSTNAME}:{PORT} -showcerts(在此处找到:@ 987654321@)
猜你喜欢
  • 1970-01-01
  • 2011-06-06
  • 1970-01-01
  • 1970-01-01
  • 2014-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多