Partager via


Bitsadmin Examples

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

BitsAdmin Examples

Example 1: Create BITS Job

You want to create a job. Type the following at the command line:

bitsadmin /create myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

Created job {2DC7527D-C7A8-444C-84A9-D772E79D4B37}.

Example 2: Get a Job's Type

You want to get the type of job for myjob. Type the following at the command line:

bitsadmin /gettype myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

DOWNLOAD

Example 3: Get a Job's Size

You want to know the size of a job. Type the following at the command line:

bitsadmin /getbytestotal myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

236

Example 4: Get the Number of Bytes Transferred for a Job

You want to know how much of the job has already been transferred. Type the following at the command line:

bitsadmin /getbytestransferred myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

106

Example 5: Get the Number of Files in a Job

You want to know how many files are in a job. Type the following at the command line:

bitsadmin /getfilestotal myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

3

Example 6: Get the Number of Files Transferred for a Job

You want to know how many files have been transferred from a job. Type the following at the command line:

bitsadmin /getfilestransferred myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

1

Example 7: Get a Job's Creation Time

You want to know when a job was created. Type the following at the command line:

bitsadmin /getcreationtime myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

6/3/2002 10:49:02 AM

Example 8: Get a Job's Last Modification Time

You want to know when a job was last modified. Type the following at the command line:

bitsadmin /getmodificationtime myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

6/3/2002 10:49:02 AM

Example 9: Get a Job's Completion Time

You want to know if and when a job has completed. Type the following at the command line:

bitsadmin /getcompletiontime myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

WORKING

The myjob job has not yet completed.

Example 10: Get a Job's State

You want to know a job's state. Type the following at the command line:

bitsadmin /getstate myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

SUSPENDED

Example 11: Get a Job's Owner

You want to know who owns a job. Type the following at the command line:

bitsadmin /getowner myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

DOMAINMAIN\smithj

Example 12: Get a Job's Display Name

You want to know the display name for a job. Type the following at the command line:

bitsadmin /getdisplayname myjob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.

myjob

Note

  • Using DisplayName as the argument for the job will work only if there is one job in the queue with this display name. Otherwise, Bitsadmin will return an error in which case, the GUID must be used.

Example 13: Add a file to a specified job

You want to add a file to a specified job. Type the following at the command line:

bitsadmin /addfile myJob https://myserver/myfile.ext c:\myFile.ext

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3652.0 ]

BITS administration utility.

(C) Copyright 2000-2002 Microsoft Corp.

Added https://myserver/myfile.ext -> c:\myFile.ext to job.

Note

  • Instead of using myJob as the parameter the previous example, you could enter the GUID of the job. You can get the GUID of the job when you do the bitsadmin /create. You can also do a bitsadmin /list to get the GUID of the job. The GUIDS are unique, but the display names are not.

Example 14: Resume a job

You want to resume a job. Type the following at the command line:

bitsadmin /resume myJob

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3652.0 ]

BITS administration utility.

(C) Copyright 2000-2002 Microsoft Corp.

Job resumed

Example 15: Delete all jobs in the manager

You want to delete all jobs in the manager. Type the following at the command line:

bitsadmin /reset

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
{A305C29C-2247-42A6-918E-C575280CE885} canceled.
{6F2D447C-712E-4674-9FAE-42DBFAD071A8} canceled.
{0B8068F6-2572-4932-AE12-CD58DA78912E} canceled.
3 out of 3 jobs canceled.

Example 16: List transfer jobs

You want to list the transfer jobs. Type the following at the command line:

bitsadmin /list

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
{A305C29C-2247-42A6-918E-C575280CE885} job1 SUSPENDED 0 / 0 0 / 0
{6F2D447C-712E-4674-9FAE-42DBFAD071A8} job2 SUSPENDED 0 / 0 0 / 0
{0B8068F6-2572-4932-AE12-CD58DA78912E} job3 SUSPENDED 0 / 0 0 / 0
Listed 3 job(s).

Example 17: Delete a specified job

You want to delete a specified job. Type the following at the command line:

bitsadmin /cancel job1

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
Job canceled

Example 18: Perform a series of operations simultaneously

You want to run a series of operations such as: /create /addfile /resume /list /complete. Type the following at the command line:

bitsadmin /create /addfile /resume /list /complete

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
Created job {9CFB8267-72BA-4725-A487-8CB1A9390637}.
 
bitsadmin /addfile job1 https://bitsnet/downloads/50mb.zip c:\temp\50mb.zip
 
BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
Added https://bitsnet/downloads/50mb.zip -> c:\temp\50mb.zip to job.
 
bitsadmin /resume job1
 
BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
Job resumed.
 
bitsadmin /list
 
BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
{9CFB8267-72BA-4725-A487-8CB1A9390637} job1 TRANSFERRING 0 / 1 2000 / 50189685
Listed 1 job(s).
 
bitsadmin /list
 
BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
{9CFB8267-72BA-4725-A487-8CB1A9390637} job1 TRANSFERRED 1 / 1 50189685 / 501896
Listed 1 job(s).
 
bitsadmin /complete
 
BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
Invalid number of arguments.
 
bitsadmin /complete job1
 
BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
Job completed.

bitsadmin /list
 
BITSADMIN version 1.5 [ 5.1.3597.0 ]
BITS administration utility.
(C) Copyright 2000-2002 Microsoft Corp.
 
Listed 0 job(s).

Example 19: Run /list /allusers /verbose

You want to run /list /allusers /verbose. Type the following at the command line:

bitsadmin /list /allusers /verbose

Press Enter. The following output is displayed:

BITSADMIN version 1.5 [ 5.2.3639.0 ]

BITS administration utility.

(C) Copyright 2000-2002 Microsoft Corp.


GUID: {134E18A6-FC4B-46AC-A7E9-B7A7D59C84BE} DISPLAY: test

TYPE: DOWNLOAD STATE: SUSPENDED OWNER: DOMAIN1\joe

PRIORITY: NORMAL FILES: 0 / 1 BYTES: 0 / UNKNOWN

CREATION TIME: 9/13/2002 12:47:10 PM MODIFICATION TIME: 9/13/2002 12:47:13 PM

COMPLETION TIME: UNKNOWN

NOTIFY INTERFACE: UNREGISTERED NOTIFICATION FLAGS: 3

RETRY DELAY: 600 NO PROGRESS TIMEOUT: 1209600 ERROR COUNT: 0

PROXY USAGE: PRECONFIG PROXY LIST: NULL PROXY BYPASS LIST: NULL

DESCRIPTION:

JOB FILES:

        0 / UNKNOWN WORKING https://www.microsoft.com-> c:\ms

NOTIFICATION COMMAND LINE: none

 

Listed 1 job(s).

 

BITSADMIN version 1.5 [ 5.2.3639.0 ]

BITS administration utility.

(C) Copyright 2000-2002 Microsoft Corp.

 

{134E18A6-FC4B-46AC-A7E9-B7A7D59C84BE} canceled.

1 out of 1 jobs canceled.

See Also

Concepts

Bitsadmin Overview
Bitsadmin Remarks
Bitsadmin Syntax
Alphabetical List of Tools
Topchk.cmd
Rsdir Overview
Rsdiag Overview
Iologsum Overview
Health_chk Overview
Ftonline Overview
Filever Overview
Efsinfo Overview
Dmdiag Overview
Dskprobe Overview
Diruse Overview
Dfsutil Overview
Connstat Overview
Cabarc Overview