bitsadmin
BITS (Background Intelligent Transfer Service) is a Windows service that moves files in the background using idle network bandwidth and resumes after a network drop or a reboot. bitsadmin is its built-in (now deprecated) command-line tool; the modern way is Start-BitsTransfer.
201.1 Why is it used?
- Large downloads/uploads (updates, installers) without slowing down the user's own work: BITS uses only idle bandwidth.
- Automatic resume: after a network loss or reboot the job continues from the same byte, not from zero.
- Retries on its own on transient errors, so scripts do not need their own retry loop.
- Built into every Windows client and server (CMD and PowerShell); some switches need an elevated prompt.
- Windows Update, SCCM/ConfigMgr and many updaters use BITS under the hood.
201.2 How it works
- An app asks BITS for a file; BITS creates a job, which waits in the QUEUED state.
- When the network is idle, BITS pulls the file in chunks into a temporary file.
- On a network drop the job moves to TRANSIENT_ERROR and BITS waits for the retry delay and tries again.
- On reconnect it sends an HTTP Range request (only the bytes after what it already has); the server replies 206 Partial Content.
- When all data is in, the state is TRANSFERRED, but the file is still temporary; /complete gives it its final name (ACKNOWLEDGED).
- Step 1
1.App asks BITS for 10mb.zip from downloadsrv: job is QUEUED (0 / 10 MB)
- Step 2
2.Idle bandwidth: chunks 0-3 MB arrive, state TRANSFERRING (3 / 10 MB)
- Step 3
3.Network goes away: TRANSIENT_ERROR, BITS retries after a delay
- Step 4
4.Network back: GET with Range: bytes=3MB- is sent to the server
- Step 5
5.Server replies 206 Partial Content with only the remaining data: TRANSFERRED
- Step 6
6./complete renames the temp file to c:\10mb.zip: ACKNOWLEDGED
BITS resumes from the same byte using HTTP Range requests
201.3 Help output (real, on this PC)
Only help commands were run on the office PC; job examples below come from the Microsoft Learn docs.
C:\Windows\System32\bitsadmin.exe /?C:\Windows\System32\bitsadmin.exe /util /?$ bitsadmin.exe /?BITSADMIN version 3.0BITS administration utility. USAGE: BITSADMIN [/RAWRETURN] [/WRAP | /NOWRAP] command/UTIL /? Prints the list of utilities commands/PEERCACHING /? Prints the list of commands to manage Peercaching/CACHE /? Prints the list of cache management commands/PEERS /? Prints the list of peer management commands $ bitsadmin.exe /util /?The following UTIL commands are available:/UTIL /SETIEPROXY <account> <usage> [/CONN <connection name>]/UTIL /GETIEPROXY <account> [/CONN <connection name>]/UTIL /VERSION [/VERBOSE]/UTIL /ENABLEANALYTICCHANNEL TRUE/FALSE- Global switches come before the command: /rawreturn gives only the raw value (for scripts, with /create and /get*).
- /wrap (default) wraps long lines; /nowrap cuts them at the right edge.
201.4 /transfer: the one-liner
bitsadmin /transfer myDownloadJob /download ^ /priority normal ^ https://downloadsrv/10mb.zip c:\10mb.zip- Creates the job, adds the file, resumes it and completes it in one command.
- Default: a download job at NORMAL priority that shows progress until done or a critical error.
- On a transient error the command keeps running; press Ctrl+C to stop it.
- /DYNAMIC relaxes the server-side requirements (for dynamic pages).
201.5 Manual job in 5 steps (scripts)
bitsadmin /create myDownloadJobbitsadmin /addfile myDownloadJob ^ https://downloadsrv/10mb.zip c:\10mb.zipbitsadmin /resume myDownloadJobbitsadmin /info myDownloadJob /verbosebitsadmin /complete myDownloadJob$ bitsadmin /create myDownloadJobcreated job {C775D194-090F-431F-B5FB-8334D00D1CB6}- /create makes the job and prints its GUID; a new job always starts SUSPENDED.
- /addfile adds the remote URL and the local file; the local name must be an absolute path.
- /resume activates the job in the transfer queue.
- /info /verbose checks progress and errors.
- When the state is TRANSFERRED, /complete makes the file available under its final name.
201.6 Monitoring: /list and /info
$ bitsadmin /list{6AF46E48-41D3-453F-B7AF-A694BBC823F7} job1 SUSPENDED 0 / 0 0 / 0{482FCAF0-74BF-469B-8929-5CCD028C9499} job2 TRANSIENT_ERROR 0 / 1 0 / UNKNOWNListed 2 job(s). $ bitsadmin /infoGUID: {482FCAF0-74BF-469B-8929-5CCD028C9499} DISPLAY: myDownloadJobTYPE: DOWNLOAD STATE: TRANSIENT_ERROR OWNER: domain\userPRIORITY: NORMAL FILES: 0 / 1 BYTES: 0 / UNKNOWNRETRY DELAY: 600 NO PROGRESS TIMEOUT: 1209600 ERROR COUNT: 0PROXY USAGE: PRECONFIG PROXY LIST: NULL PROXY BYPASS LIST: NULLERROR CODE: 0x80072ee7 - The server name or address could not be resolved0 / UNKNOWN WORKING https://downloadsrv/10mb.zip -> c:\10mb.zip- /list shows one line per job: GUID, name, state, files and bytes.
- /info shows full details: retry delay 600 s, no-progress timeout 1209600 s, proxy usage, error code.
- 0x80072ee7 = the server name could not be resolved, so BITS will retry after the retry delay.
- /monitor [/allusers] [/refresh 60] keeps refreshing the list live; /get* switches read one property (bytes, times, owner, error).
201.7 Job states (/getstate)
| State | Meaning |
|---|---|
| QUEUED | The job is waiting to run. |
| CONNECTING | BITS is contacting the server. |
| TRANSFERRING | BITS is transferring data. |
| TRANSFERRED | All files arrived; now run /complete. |
| SUSPENDED | Paused; every new job starts here. |
| ERROR | Nonrecoverable error, no retry; check /geterror. |
| TRANSIENT_ERROR | Recoverable error; retried after the min retry delay. |
| ACKNOWLEDGED | The job completed. |
| CANCELED | The job was canceled. |
201.8 Per-job settings: properties, notify, proxy, credentials, HTTP, peers
/setdisplayname job NightlyDownload/setpriority job FOREGROUND | HIGH | NORMAL (default) | LOW/setminretrydelay job 35 retry delay (seconds)/setnoprogresstimeout job 20 when it becomes fatal/setmaxdownloadtime job 10 max download time/setnotifyflags job 3 event on done or error/setnotifycmdline job prog.exe "prog a b"/setproxysettings job PRECONFIG | NO_PROXY | AUTODETECT/setproxysettings job OVERRIDE proxy1:80 "<local>"/setcredentials job SERVER|PROXY BASIC|DIGEST|NTLM|NEGOTIATE|PASSPORT user pwd/setcustomheaders job "hdr1" "hdr2"/setsecurityflags job <value>/setpeercachingflags job 1|2|3| Area | Key switches | What it controls |
|---|---|---|
| Properties | /setpriority, /setminretrydelay, /setnoprogresstimeout, /setmaxdownloadtime | Priority and how long BITS keeps trying |
| Notifications | /setnotifyflags 1-4, /setnotifycmdline | Event on done/error; run a program (e.g. auto /complete) |
| Proxy | /setproxysettings PRECONFIG | NO_PROXY | AUTODETECT | OVERRIDE | Per-job proxy list and bypass list |
| Credentials | /setcredentials, /setclientcertificatebyname, /sethelpertoken | Server/proxy auth, client cert, helper token |
| HTTP | /setcustomheaders, /sethttpmethod, /setsecurityflags | Headers, verb, CRL check, cert errors, redirect policy |
| Upload-reply | /setreplyfilename, /getreplydata, /getreplyprogress | Server reply of an upload-reply job |
| Peer caching | /setpeercachingflags 1|2|3 | Download from / serve to LAN peers |
201.9 Peers, cache and /util
/peers /discover | /clear | /list/cache /list [/verbose]/cache /setlimit 50 50% of the disk/cache /setexpirationtime 60 seconds/util /version [/verbose]/util /repairservice [/force]/util /getieproxy NETWORKSERVICE/util /setieproxy localsystem AUTODETECT- /peers manages the LAN peer list; /cache lists, deletes or clears peer-cache entries and sets size and expiry.
- /util /version shows the BITS version; /util /repairservice repairs the service.
- /util /setieproxy sets the IE proxy of service accounts (LOCALSYSTEM, NETWORKSERVICE); it and /enableanalyticchannel need admin.
- /reset [/allusers] cancels every job of the current user (or all users) in one go: be careful.
201.10 Modern way: Start-BitsTransfer
Import-Module BitsTransferStart-BitsTransfer ` https://server/dir/myfile.txt ` C:\docs\myfile.txtImport-CSV filelist.txt | Start-BitsTransfer -Asynchronous ` -Priority Normal- The BitsTransfer PowerShell module does the same job; the docs say BITSAdmin is deprecated since Windows 7.
- -Asynchronous returns the prompt immediately and the job keeps running in the background.
- Get-BitsTransfer shows job state; Complete-BitsTransfer finishes an async job.
201.11 Practical (Linux lab): the same resume idea
Docker lab: server 192.168.221.10 serves a 10 MB file with busybox httpd, client 192.168.221.20 uses curl and wget.
curl -sI http://192.168.221.10/10mb.zipcurl -s -o /dev/null -D - -r 0-99 \ http://192.168.221.10/10mb.zip$ curl -sI http://192.168.221.10/10mb.zipHTTP/1.1 200 OKAccept-Ranges: bytesETag: "6af1be7e-a00000"Content-Length: 10485760 $ curl -s -o /dev/null -D - -r 0-99 http://192.168.221.10/10mb.zipHTTP/1.1 206 Partial ContentContent-Range: bytes 0-99/10485760Accept-Ranges: bytesContent-Length: 100- Accept-Ranges: bytes means the server can send any part of the file.
- -r 0-99 asks for the first 100 bytes: 206 Partial Content, Content-Range: bytes 0-99/10485760.
timeout 3 curl -sS --limit-rate 1M \ -o 10mb.zip http://192.168.221.10/10mb.zipls -l 10mb.zipcurl -sS -v -C - --limit-rate 4M \ -o 10mb.zip http://192.168.221.10/10mb.zipsha256sum 10mb.zip$ timeout 3 curl -sS --limit-rate 1M -o 10mb.zip http://192.168.221.10/10mb.zipTerminatedcurl stopped: 143$ ls -l 10mb.zip-rw-r--r-- 1 root root 3222880 Nov 9 12:37 10mb.zip$ curl -sS -v -C - --limit-rate 4M -o 10mb.zip http://192.168.221.10/10mb.zip> GET /10mb.zip HTTP/1.1> Range: bytes=3222880-< HTTP/1.1 206 Partial Content< Content-Range: bytes 3222880-10485759/10485760< Content-Length: 7262880$ ls -l 10mb.zip-rw-r--r-- 1 root root 10485760 Nov 9 12:37 10mb.zip$ sha256sum 10mb.zip7c10fe14f5a6948e8d02ef04cc552bcb6ce0e8e0f079911218f62ed7e50e6316 10mb.zip(server) $ sha256sum /srv/10mb.zip7c10fe14f5a6948e8d02ef04cc552bcb6ce0e8e0f079911218f62ed7e50e6316 /srv/10mb.zip- timeout killed the 1 MB/s download after 3 s: only 3222880 bytes stayed on disk.
- curl -C - reads the file size and sends Range: bytes=3222880- by itself; the server sends only 7262880 bytes.
- The SHA-256 of the resumed file matches the server's file exactly.
wget -q -O - http://192.168.221.10/10mb.zip \ | head -c 3145728 > w.zipwget -c -S -O w.zip \ http://192.168.221.10/10mb.zipsha256sum w.zip$ ls -l w.zip-rw-r--r-- 1 root root 3145728 Nov 9 12:37 w.zip$ wget -c -S -O w.zip http://192.168.221.10/10mb.zip HTTP/1.1 206 Partial Content Content-Range: bytes 3145728-10485759/10485760'w.zip' saved$ sha256sum w.zip7c10fe14f5a6948e8d02ef04cc552bcb6ce0e8e0f079911218f62ed7e50e6316 w.zip- Step 1
1.Client starts download at 1 MB/s
- Step 2
2.timeout 3 kills it: 3222880 bytes on disk
- Step 3
3.curl -C - sends Range: bytes=3222880-
- Step 4
4.Server: 206 Partial Content, bytes 3222880-10485759/10485760
- Step 5
5.File is 10485760 bytes; sha256sum matches the server
Same mechanism BITS uses on Windows
201.12 Common mistakes
- State is TRANSFERRED but no file on C: you forgot /complete (data is still in a temp file).
- Thinking BITS downloads from any URL: the server's HEAD must return the size and GET must support Content-Range/Content-Length, so mostly static files work.
- A dynamic page without these headers sends the job to ERROR; use /DYNAMIC with /transfer.
- Giving a relative local path to /addfile: it must be absolute.
- Running /reset casually: it cancels every job of the user.
201.13 Interview tips
- BITS = Windows service for background transfers using idle bandwidth; resumes with HTTP Range requests after a drop or reboot.
- Job flow: QUEUED -> TRANSFERRING -> TRANSFERRED -> /complete -> ACKNOWLEDGED.
- TRANSIENT_ERROR is retried automatically; ERROR is not (check /geterror).
- bitsadmin is deprecated; new scripts use Start-BitsTransfer, bitsadmin stays for troubleshooting.