%SystemRoot%System32 secrets: BITSAdmin

CLIAnother deprecated friend of mine. But I still like it, really. First of all because I haven’t still found enough time to get acquainted with all that *-BITSTransfer PowerShell comandlets. Second… Well, there is nothing for the “second”, naturally =) But still – it is a great command and I’d like to make a tribute to it with this article, because it is AWESOME! It is soooo powerful! Even though I used it usually just to be sure I would download the file regardless of network loss or whatever, it can do much more. Download or upload, retry these tasks, get some part of the file, set myriads of parameters, including authentication, use peer caching… Wow! =)

But again, usually I used it to download large files. Let’s take a look at one example.

Lets start with creating a download job:



You can see that the job has been created and it has been assigned some GUID you can use later (but we’ll use it’s name in this example). Also as you can see we are being constantly notified about the command deprecation =( Let’s take a look at the job:



(Yeah, a LOT of information). Obviously, the job is currently empty (FILES: 0 / 0), so let’s add some files to it:

BITSadmin /ADDFILE DownloadJob1 <URL> <PathToSavedFile>


Added successfully and created a temp file already:


Let’s add one more:


and look at the second temporary file:


They are both of 0 bytes size yet. Now, once we have two files for our job to download, we can get more info from the job:


Here we can see both our files (JOB FILES) and… Can we just wait till the files get downloaded? No, because the job is not started at the moment (STATE: SUSPENDED). We need to start it and this is easy:



Now the job is in TRANSFERRING state, we can see how many bytes (BYTES) or files (FILES) has been transferred and so on. On this point something goes wrong and we get our network disconnected: image. Is it a problem for our downloads? Yes:


their state is TRANSIENT_ERROR. Should we worry about it? No, because as soon as network restores we’ll get our job QUEUD and then resumed automatically:


Looking at this big picture from time to time reentering /LIST command is boring, so we’ll monitor it in other way:



which will refresh the state for our jobs occasionally (each 1 second in the example):


As soon as we get our files transferred:


we can just go to our download location and… Oh… Wait… What’s that?


The files do have appropriate size but their names… They are still temporary =( But don’t worry, just one more little step:

BITSadmin /COMPLETE downloadJob1


Oops. Seems like BITSadmin treats job names as case-sensitive. We should remember this, so let’s rewrite it in the correct way:

BITSadmin /COMPLETE DownloadJob1


Here we are! The files are here and no more job to do! I’m loving it © =)


Forgive me for that useless lesson: just couldn’t resist it Winking smile

If you are as amazed, as I am, here is some reading.

1 thought on “%SystemRoot%System32 secrets: BITSAdmin

  1. Pingback: BITS Transfer PowerShell cmdlets » IT, IS, etc…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s