BITS – Background Intelligent Transfer Services in Windows XP SP2 / SP3

I read about BITS a few years back when they first started development on it. I remember thinking it looked interesting and the fact that you could use it in your own applications could prove to be useful one day. I’ve really not had a chance to look at it since then but just today I was trying to configure WSUS so I wouldn’t have to manually install the .NET framework on every last machine and wanted to know more about how WSUS works. Lo and behold WSUS uses BITS on the client computers.

So I did some searching and found this: Bitsadmin.exe: BITS Administration Utility. Neat, so all I need to do is run Bitsadmin at the command line and voila, I’ll have my WSUS download status, right? Wrong. It seems even though my machine is all patched and up to date, has 3 versions of Visual Studio on it including VS 2010, I did not have a copy of Bitsadmin.exe in my path. I even did a windows search for the file on c: and nada, nope, nothing. So, surprised that there was something in the windows universe that I had yet to install I searched for that and wound up here: Windows XP Service Pack 2 Support Tools. It seems there is no “Windows XP Service Pack 3 Support Tools” at the present.

So I download my latest discovery and install, then try running “Bitsadmin” at the console and, what, nothing? I close and re-open the console, and voila! I get: BITSADMIN version 2.0 …
Yeah! The install must of either updated my path variable or the console window somehow caches the list of files available to run, no matter re-starting worked. So, now I want to monitor the status of my windows download so I try bitsadmin /? and get… well I get way too much info to post here. I wind up running this command:
Bitsadmin /list
And get: nothing
Wha? Well, I’ll have to figure out what’s up with WSUS later, right now I want to get my new Bitsadmin toy doing something! It appears it’s able to download a file from a URI, the question is what am I going to find that I can download by URI? It needs to be a relatively good size for a good test of bits, a regular html page isn’t going to cut it. After some thinking about where I can find a unprotected exe I finally decide on FireFox, which seems ironic since it’s a Microsoft tool and the first thing I’m going to download with it is FireFox. I do a little searching and find this:
Index of /pub/
and I decide to download this URI for my test:

So, back to bits. I do some more help doc reading and decide this is my command to run:
Bitsadmin /addfile FireFoxDownload “” c:\FireFoxSetup203.5.exe
No dice, I get an error about job name being invalid, so some more searching through the help file and /CREATE looks promising so I try:
Bitsadmin /CREATE /UPLOAD FireFoxDownload
Success! Then I re-run:
Bitsadmin /addfile FireFoxDownload “” c:\FireFoxSetup203.5.exe
and all seems well. Curious to the state of my download I try to query it:
Bitsadmin /list
hrm, seems the file is status SUSPENDED, that seems non optimal. More reading, huzzah! I try this:
Bitsadmin /resume FireFoxDownload
and then
Bitsadmin /list
and things appear to be working well. Every time I run Bitsadmin /list the bit amount increments. Finally it’s at 100% and I check my c:\ drive:
Again, odd, no c:\FireFoxSetup203.5.exe file anywhere. Back to the help doc. I run:
Bitsadmin /complete FireFoxDownload
and then go back to c: and the file is there. Now for my final test, will it run? Yep, works like a charm, er, one unfortunate side affect though. It seems I’ve downloaded the french version of FireFox.

During this process I discovered another option. There appears to be a /TRANSFER option that will download the file in one easy step. So back to the FF website to try and find the English version. I’ve decided to try:
Here’s my new command:
Bitsadmin /transfer FireFoxDownload /download “”
and I get:
Invalid argument
hrm, I was hoping to avoid inputting priority and ACL, there does not seem to be a indication as to what valid values for /PRIORITY are. I’m going to guess it’s a integer, here goes:
Bitsadmin /transfer FireFoxDownload /download /priority 1 “”
Aaannndddd…. no good. I google search and come up with this:
The priority is either FOREGROUND, HIGH, NORMAL, LOW, or UNKNOWN.
Once again:
Bitsadmin /transfer FireFoxDownload /download /priority high “”
Invalid argument?!? I’ll be back when I have the command that actually works….
This guy just posted the Bitsadmin /?.
Hrm, better MS doc: Bitsadmin /transfer.

Finally!! Working:
Bitsadmin /transfer FireFoxDownload /download /priority high “” “c:\FirefoxSetup203.5en.exe”
Oops, I forgot the local path. Anyway, time for the file is still intact test, run it from “c:\FirefoxSetup203.5en.exe”
YES! Worked like a charm.

To recap:
How to download a file Using BITS and queuing:
Bitsadmin /CREATE /UPLOAD FireFoxDownload
Bitsadmin /addfile FireFoxDownload “” c:\FireFoxSetup203.5.exe
Bitsadmin /resume FireFoxDownload
Bitsadmin /list –Once file is 100% run the next line:
Bitsadmin /complete FireFoxDownload

How to download a file using BITS immediately:
Bitsadmin /transfer FireFoxDownload /download /priority high “” “c:\FirefoxSetup203.5en.exe”

Where Can I Get the Bitsadmin Tool?
Here: Windows XP Service Pack 2 Support Tools. It seems there is no “Windows XP Service Pack 3 Support Tools” at the present.

Happy BITSing!
— Anthony