WebClient请求期间发生异常(Powershell)

时间:2018-01-04 22:45:05

标签: powershell

我正在尝试使用Powershell从我们的HTTP服务器复制目录文件夹,我想将它的全部内容(包括子文件夹)复制到我当前服务器的本地驱动器中。这是我的代码

$source = "http://servername/serverupdates/deploy/Program%20Files/"
$destination = "C:\Program Files"
$client = new-object System.Net.WebClient
$client.DownloadFile($source, $destination)

当我在Powershell ISE中以管理员身份运行脚本时,收到错误消息

  

“使用”2“参数调用”DownloadFile“的异常:”WebClient请求期间发生异常。“

有关可能发生的事情的任何建议吗?

1 个答案:

答案 0 :(得分:0)

你可以更容易地做这样的事情。

wget.exe --mirror --no-parent' this' -P' C:\ Program Files'

注意:未经测试

相关问题