Question

[string] $fileName = "en_sql_server_2008_r2_developer_x86_x64_ia64_dvd_522665.iso"
[string] $url = "http://installers.abc/iso/$filename"
[string] $tempPath = "c:\balpreet"

function Download-Iso {
  Param(
    [string] $FileName,
    [string] $Url,
    [string] $destinationFolder 
  )

  [string] $destination = Join-Path -Path $tempPath -ChildPath $fileName 
  write-host "downloading from : $url to $destination"
    $client = new-object System.Net.WebClient
    $client.DownloadFile( $Url, $destination )

}

Download-Iso -FileName $fileName -Url $url -DestinationFolder = $tempPath

I'm trying to download 4.07 GB (4,380,329,984 bytes) ISO from remote location accessible over http.

Windows 7 : It download complete 4.07 GB file.

Windows Server 2008 R2 : It download only 81.4 MB (85,363,075 bytes) and pretend to completed the download. Code is not throwing any error, but not downloading complete file as well.

Any clue why?

Was it helpful?

Solution

It was internal network proxy which was for some reason dropping the request after 81.4 MB (85,363,075 bytes) were transfered. But the weird thing is webclient was not throwing any exception and was pretending that download was successful.

Fix is to null the proxy so request is processed without going through proxy.

$client.proxy=$null  # get rid of proxy
$client.DownloadFile( $Url, $destination )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top