Use this cmdlet to remove a SyncTask from the task queue. Removed tasks are marked as removed and are purged after 14 days (except for free-use licenses, which purge after 24 hours).
PowerShell
Remove-SyncTask
- -TaskID
- [-Force]
Description
The Remove-SyncTask cmdlet removes one or more tasks from the task queue. Removing a task marks it for purge, but does not immediately remove it task. Removed tasks will not be processed by the task engine. If a task is added to the task queue, but is never started, removing the same task does not cause it to marked for removal, but is removed immediately.
Removing and adding tasks is affected by the license. Review the Licensing topic of this documentation for details about how the licenses applies.
Examples
Example 1
PowerShell
Remove-SyncTask 12345678-abcd-1234-abcd-1234567890ab
This example will attempt to remove the SyncTask with the ID provided. A prompt for confirmation will occur unless the -Force parameter is also used.
Example 2
PowerShell
Remove-SyncTask -TaskID 12345678-abcd-1234-abcd-1234567890ab, 00112233-aabb-ccdd-eeff-998877665544, 01020304-0000-1111-2222-010203040506 -Force
This example will attempt to remove 3 tasks and no confirmation will be prompted.
Example 3
PowerShell
$tasks = Get-SyncTask | Where-Object {$_.State -eq 'Completed'}
Remove-SyncTask -TaskID $tasks
This example requests all the Completed sync tasks from the system and attempt to remove them. The Remove-SyncTask cmdlet will attempt to find a ‘TaskID’ property on objects passed to it.
Example 4
PowerShell
$tasks = Get-SyncTask | Where-Object {$_.State -eq 'Completed'}
$tasks | Remove-SyncTask -Force
This example will use pipelining to pass the list of Completed tasks to the cmdlet and will attempt to remove each without a prompt.
Parameters
-TaskID
The TaskID parameter specifies one or more tasks that are to be removed.
-Force
The Force parameter determines whether a confirmation prompt is shown to accept the removal.
Output
This cmdlet will place a numeric value on the pipeline indicating the number of tasks that were removed.
