switch to BITS for file download
This commit is contained in:
@@ -189,7 +189,8 @@ Function Download-File {
|
|||||||
$URI = Get-AbsoluteURI -URL $URL
|
$URI = Get-AbsoluteURI -URL $URL
|
||||||
If ( $null -eq $URI ) { Return }
|
If ( $null -eq $URI ) { Return }
|
||||||
If ( [string]::IsNullOrEmpty($File) ) { $File = '{0}{1}' -f (Get-TempPath), (Split-Path $URI -Leaf) }
|
If ( [string]::IsNullOrEmpty($File) ) { $File = '{0}{1}' -f (Get-TempPath), (Split-Path $URI -Leaf) }
|
||||||
Try { (New-Object System.Net.WebClient).DownloadFile($URI,$File) }
|
#Try { (New-Object System.Net.WebClient).DownloadFile($URI,$File) }
|
||||||
|
Try { Start-BitsTransfer -Source $URI -Destination $File }
|
||||||
Catch { Write-Error $_.Exception.Message ; Return }
|
Catch { Write-Error $_.Exception.Message ; Return }
|
||||||
Return $File
|
Return $File
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user