Consider Start-BitsTransfer for Download
Closed this issue · 4 comments
Hi,
please consider using Start-BitsTransfer for Downloads, as it is much faster.
Hi DarthMarx,
Thanks for your comment. Sorry I've totally missed it.
Can you please provide more context or reference? What is exactly the script or function are you referring to?
Regards
This is the code I was referring to:
Hi DarthMarx,
Frankly, for small files I don't pay much attention to it, but I do know what is the performance issue you are experiencing and referring to is caused in this case, because I faced/solved this multiple times.
Bits in this scenario is not necessary much faster than Invoke-WebRequest, but what you see is the bottleneck caused by the progress bar that is more frequently updated by Invoke-WebRequest.
If you want to test it yourself run this following snippet removing the progress bar on both cmd-lets:
$WAC_Online = "http://aka.ms/WACDownload"
$WAC_Installer = "C:\windows\Temp\wac.msi"
$ProgressPreference = 'SilentlyContinue'
Measure-Command{Invoke-WebRequest -Uri $WAC_Online -OutFile $WAC_Installer}
Measure-Command{Start-BitsTransfer -Source $WAC_Online -Destination $WAC_Installer}
In my tests Invoke-WebRequest was always faster.
Bits is very convenient for larger files, but in this specific case I would still prefer invoke-webrequest. Let me know what you think.
Thanks,
Regards
I will mark this as resolved.