Using BITS to Download Files (Part 1)

by Mar 26, 2021

BITS (Background Intelligent Transfer System) is the technique used by Windows to download huge files such as operating system updates. You can use the same system, too, to download large files. As an extra benefit, you get a nice progress bar while the file is downloading. This example downloads a NASA Mars report and plays the video after downloading it:

$url = 'https://mars.nasa.gov/system/downloadable_items/41764_20180703_marsreport-1920.mp4'
$targetfolder = $env:temp
$filename = Split-Path -Path $url -Leaf
$targetFile = Join-Path -Path $targetfolder -ChildPath $filename

Start-BitsTransfer -Source $url -Destination $targetfolder -Description 'Downloading Video...' -Priority Low 


Start-Process -FilePath $targetFile

Note how Start-BitsTransfer lets you select a downloading priority so you can download files without hogging network bandwidth that is needed for more important things. Note also that BITS won’t work with all downloads. The server needs to support the technology.


Twitter This Tip! ReTweet this Tip!