Remove-BitsTransfer

Remove-BitsTransfer

Cancels a BITS transfer job.

Syntax

Parameter Set: Default
Remove-BitsTransfer [-BitsJob] <BitsJob[]> [-Confirm] [-WhatIf] [ <CommonParameters>]




Detailed Description

The Remove-BitsTransfer cmdlet cancels a Background Intelligent Transfer Service (BITS) transfer job. It deletes the underlying transfer job, removes any temporary files from the client, and deletes the associated BitsJob object.

When the Remove-BitsTransfer cmdlet cancels a transfer job, it deletes all the transfers. Consider a scenario is which you are transferring three files. One file is completely transferred, one file is pending, and one file is currently being transferred. In this scenario, Remove-BitsTransfer cancels the whole transfer and deletes the underlying files. Any files that were already transferred are not available after you use the Remove-BitsTransfer cmdlet to cancel the transfer job. Optionally, you can use the Complete-BitsTransfer cmdlet to commit any files that are completely downloaded and to cancel the pending and current transfers. The transferred file is not be deleted and is available.

Parameters

-BitsJob<BitsJob[]>

Specifies an array of BITS transfer jobs to cancel. You can pipe a value to this parameter from other cmdlets that return BitsJob objects, such as the Get-BitsTransfer cmdlet.


Aliases

b

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.BackgroundIntelligentTransfer.Management.BitsJob[]

    This cmdlet accepts one or more BitsJob objects as input that populates the BitsJob parameter.


Outputs

The output type is the type of the objects that the cmdlet emits.

  • None

    This cmdlet does not generate any output.


Notes

  • After a job is removed or completed, any job objects that were previously cached in variables or in scripts are no longer valid.

Examples

Example 1: Cancel all BITS transfer jobs owned by the current user

This command cancels all the BITS transfer jobs that are owned by the current user.

The output of the Get-BitsTransfer cmdlet is piped to the Remove-BitsTransfer cmdlet. The output is a set of BitsJob objects.


PS C:\>Get-BitsTransfer | Remove-BitsTransfer

Example 2: Cancel all BITS transfer jobs on the computer

This command cancels all the BITS transfer jobs on the computer.

The first command gets all the BitsJob objects on the computer and then stores them in the $Bits variable.

The second command uses the BitsJob parameter to pass the BitsJob objects that are stored in the $Bits variable to the Remove-BitsTransfer cmdlet.


C:\PS>$Bits = Get-BitsTransfer -AllUsers
PS C:\> Remove-BitsTransfer -BitsJob $Bits

Related topics

Community Additions

ADD
Show: