Use this cmdlet to reset a failed or completed sync task, which causes it to be re-queued.
PowerShell
Reset-SyncTask
- -TaskID
- [-IncludeCompletedTasks]
Description
The Reset-SyncTask cmdlet is used to reset and requeue a sync task.
It can happen that an error occurs during the processing of a sync task. Network connections can drop, databases can fail over, odd stuff can happen in a live environment. When such things occur, the sync task status will have a state of Error and will be left in the task queue, but will not have any further processing attempted while in this state.
The Reset-SyncTask makes it easy to simply change the state to Reset so that the task engine can pick it up and process it again.
This cmdlet can also reset completed tasks in order to have them reprocessed. In this way, one can re-sync the same tasks multiple times without having to remove and re-add them.
Examples
Example 1
PowerShell
Get-SyncTask -States Error | Reset-SyncTask 2
This example retrieves all the sync tasks in the task queue with a State of Error and passes the results to the Reset-SyncTask cmdlet.
The cmdlet will report the number of tasks affected by the command. In this example, 2 tasks were reset.
Example 2
PowerShell
Get-SyncTask -States Completed | Reset-SyncTask -IncludeCompletedTasks 2
This example retrieves all the sync tasks in a completed state, and passes the list to Reset-Sync task. The -IncluedCompletedTasks allows for the reset of completed tasks; without this parameter, the resets would be skipped.
The cmdlet will report the number of tasks affected by the command. In this example, 2 tasks were reset.
Example 3
PowerShell
Reset-SyncTask -TaskID 11223344-aabb-ccdd-112233445566 1
This example will reset the specific task with the provided TaskID. If not task is found, the cmdlet will return a value of zero on the pipeline. This example returns a value of 1, showing that one task was reset.
Parameters
-TaskID
The TaskID parameter specifies one or more tasks for which a reset should occur. The cmdlet will look for a property called ‘TaskID’ on any objects passed on the pipeline, unless the value is already a GUID value. As such, this parameter will respond to either a GUID or a ServiceTaskItem object. Get-SyncTask returns ServiceTaskItem objects.
-IncludeCompleteTasks
The IncludeCompletedTasks switch parameter determines whether the resetting of completed tasks is allowed.
Output
This cmdlet will place a numeric (Int32) value on the pipeline that is the number of tasks that were reset. A value of zero means no tasks were reset.
