Wednesday, July 06, 2005

BITSAdmin Tool / Downloading

Have you had any problems with the Background Intelligent Transfer Service ? ( BITS) I did, and it took me quite a while and various resources to figure how this tool worked. I really needed it because its useful for downloading updates for you applications and also for backing up things such as your laptop to another server. Windows update uses this tool to slowly download updates. First of all ill show you how to download and upload with the bitsadmin tool ( bitsadmin.exe ). Lastly ill show you how to download using this code in C# without needing to know any C++. Just for basic use; here is microsofts docs on the tool LINK . Not too clear? They say to extract the most recent version from the windows xp service pack 2 support tools. I would get it ( version 2.0) here. I created a bat file to make the usage easier. To download is pretty Simple, try these in a cmd window. [Note, i replaced my previous intructions here with a .bat file instead]

bitsdownload.bat

@echo off
echo usage: %0 RandomJobName FullPathToSource FullPathToDest
echo i.e. %0 myJob141112 http://MyServer.com/file.txt c:\temp\file.txt
if "%1"=="" goto end
Bitsadmin /create %1
Bitsadmin /addfile %1 %2 %3
Bitsadmin /resume %1
Bitsadmin /info %1 /verbose
rem Bitsadmin /monitor
:end

Note that some servers dont support downloading with this. Also there is a parameter to notify you when the download is complete. Hope this helps someone.

0 Comments:

Post a Comment

<< Home