使用Powershell下载.EXE文件

时间:2017-12-02 01:29:11

标签: powershell

我试图通过powershell从https://helpx.adobe.com/acrobat/kb/acrobat-2017-downloads.html静默下载安装程序。似乎某些东西阻止了我在服务器端的访问,或者我采取了错误的步骤来下载此文件。任何建议都表示赞赏。

注意:除非您首先在浏览器中点击downloads.html页面,否则.exe链接不起作用

代码:

$outfile = .\PATH\TO\MYFILE
$url = @("https://helpx.adobe.com/acrobat/kb/acrobat-2017-downloads.html","http://trials3.adobe.com/AdobeProducts/APRO/Acrobat_HelpX/win32/Acrobat_2017_Web_WWMUI.exe")

Invoke-WebRequest -URI $url[0]
Invoke-WebRequest -Uri $url[1] -OutFile $outfile

我希望该文件能够下载,但是我收到服务器的下载错误。

错误:

  

Invoke-WebRequest:访问被拒绝   您无权访问此服务器上的“http://trials3.adobe.com/AdobeProducts/APRO/Acrobat_HelpX/win32/Acrobat_2017_Web_WWMUI.exe”。

     

参考编号#18.6ef0fea5.1512177436.8f90778

     

在行:1个字符:1   + Invoke-WebRequest -Uri $ url [1]   + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       + CategoryInfo:InvalidOperation:(System.Net.HttpWebRequest:HttpWebRequest)[Invoke-WebRequest],WebException       + FullyQualifiedErrorId:WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

0 个答案:

没有答案
相关问题