One friend of mine told me that I shouldn’t have spread knowledge about BITSAdmin command while there was the PowerShell cmdlets in place. Well, to some extent he is definitely right:
1) PowerShell is better self-documented.
2) It is waaaay easier to script with.
3) It is more simple to use in some basic situations like “just give me that darn file”.
4) Many people just like PoSh.
So, the tasks I did in my post about BITSAdmin seems to be done in one command:
Start-BitsTransfer –source <URL> –destination <PathToFile>
but one need to do his homework better:
Seems like the module for BITS is not imported by default. Let’s correct the mistake:
and now we have our cmdlets:
So, let’s our download begin:
Excellent, isn’t it (it even show the progress very visually)? No, it isn’t. Because when I turned my network connection off the download was cancelled:
Even though it was stated that “BITS will try again” – it wouldn’t and there wasn’t any job registered with BITS. I don’t know why, actually (I hope my friend will explain it to me), but I found a “workaround”. Just add “-Asynchronous” option to the string and it will fork just fine for you although you won’t be able to see that beautiful download bar:
But even when the state changed to “Transferred”, there was only a .tmp file in my directory. Actually, when I started the command without “-Asynchronous” option, I’ve got the file immediately after the end of the transfer, but you already know that you cannot then resume the transfer if it was interrupted. Therefore, I had to complete the transfer manually:
Not very big difference from what we did with BITSAdmin, I guess. And I couldn’t tell how to do is to monitor my jobs in fasion BITSAsmin /MONITOR does.
So, let’s sum it up:
1) PoSh is best for scripting
2) You can use for interactive tasks whichever command set you are used to, but remember, that BITSAdmin can be discontinued any moment
So, my best approach is, do everything I can with PoSh and monitor with BITSAdmin, until someone tells me how to do it with PoSh