1
我想使用PowerShell上传大型备份文件(〜1-2GB)。我使用一个HTTP POST,试图把文件,但我得到这个错误:使用PowerShell上传大文件到OneDrive
Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.
At C:\Repository\Powershell\PS-LaptopBackup\OneDrive Upload\main.ps1:61 char:71
+ $bak_files | foreach-object { Write-Host "UPLOADING: $($_.Name)"; Invoke-Res ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
我使用上传命令是
Invoke-RestMethod -Uri "$($upload_location)/$($_.Name)`?access_token=$AccessToken" -Method Put -InFile $_.FullName -TimeoutSec 3600
命令的作品,但它抛出这个错误。我认为这是因为HTTP连接失败。是否有另一种与OneDrive互动的方式?
感谢, 纳特
您可以尝试使用允许自动重试和异步传输的bitstransfer。 http://technet.microsoft.com/library/dd819420.aspx – 2014-08-28 05:22:28