Use this cmdlet to stop an actively processing SyncTask.
PowerShell | ParameterSet: "TaskIDs"
Stop-SyncTask
- -TaskIDList
- [-Force]
PowerShell | ParameterSet: "TaskID"
Stop-SyncTask
- -TaskID
- [-Force]
Description
The Stop-SyncTask cmdlet is used to stop a actively processing task.
Each active SyncTask executes using a separate background process. This cmdlet will check to see if the TaskID or TaskIDs provided exist in the task queue and if an active worker process exists for the task. If an active worker process is found, a signal is sent to the worker to stop processing. Note that it may take a few seconds before the task terminates as it will need to check the stop request between processing loops and will need to gracefully release handles and memory.
Examples
Example 1
PowerShell
Stop-SyncTask -TaskID 11223344-aabb-ccdd-eeff-112233445566
This example attempts to stop the task with the specific TaskID. If no task is found, or no worker process is associated with it, nothing happens.
Example 2
PowerShell
$tasks = Get-SyncTask -States Processing $tasks | Stop-SyncTask -Force
This example will pas the list of tasks on the pipeline to cause all tasks that were in a processing state to be stopped. The -Force parameter is used to prevent a prompt for confirmation.
Example 3
PowerShell
Stop-SyncTask -TaskIDList 11223344-aabb-ccdd-eeff-112233445566, 10203040-0000-1111-2222-102030405060, abacadae-1234-2345-3456-aabbccddeeff
This Example will attempt to stop the three tasks provided as an array.
