Asynchronous Downloads with BITS

by Oct 15, 2009

In a previous tip, you learned how to use BITS on Windows 7 to download files in the background. One issue with this approach is that the download worked only as long as PowerShell ran and also blocked the PowerShell console. BITS would not continue if you closed the console before the download was complete.

So, all you need for large downloads is mark the operation as asynchronously. This way, it will run as a background job and be scheduled with Windows. No longer will the PowerShell console have to wait for the download to complete, and the download will continue even when you close PowerShell or reboot your machine. The next line grabs PowerShellPlus 32Bit asynchronously and saves it on your hard drive:

Start-BitsTransfer http://downloads.idera.com/products/IderaPowerShellPlusInstallationKit.zip `
$home\psplus32bit.zip -async

Get-BitsTransfer will list all pending downloads and also let you know whether the download has completed or its progress:

Get-BITSTransfer | Format-List *

Twitter This Tip! ReTweet this Tip!