Use this cmdlet to reorder the QueuePosition on multiple SyncTasks in the task queue.
PowerShell | ParameterSet: "NoParamters"
Reset-QueuePosition
PowerShell | ParameterSet: "AllTasks"
Reset-QueuePosition
- [-ResetAllTasks]
- [-StartingPosition]
- [-Interval]
PowerShell | ParameterSet: "SelectedTasks"
Reset-QueuePosition
- [-TaskID]
- [-StartingPosition]
- [-Interval]
Description
The Reset-QueuePosition cmdlet is used to reorder SyncTask objects in the task queue in series.
This cmdlet is useful for cases where many tasks have been added with the same QueuePosition, which is common because the QueuePosition parameter of Add-SyncTask is not required and defaults to zero. As such, if many objects were added to the task queue using the default value, all of those tasks will have the same QueuePosition and will be processed in the order in which they were added.
This cmdlet can set new QueuePosition values on those tasks in sequential order so that each task has an explicit QueuePosition. Additionally, through the use of the -Interval parameter, the new QueuePosition values can be incremented at a set interval in order to create some spacing between the tasks in case of the later need to insert a task between two others.
Examples
Example 1
PowerShell
Reset-QueuePosition
This example will reorder all tasks in the task queue starting from zero and incrementing each new value by one.
Example 2
PowerShell
Reset-QueuePosition -StartingPosition 100 -Interval 10
This example will reset the QueuePosition of all tasks in the task queue starting at 100 and incrementing by 10 for each. Example: 100, 110, 120, 130, 140, etc.
Example 3
PowerShell
$tasks = Get-SyncTask -States Completed $tasks | Reset-QueuePosition -Interval 5
This example retrieves all the completed tasks from the task queue and reorders them, starting from zero, and incrementing by five.
Parameters
-ResetAllTasks
The ResetAllTasks parameter determines whether all the task in the task queue are reordered.
-TaskID
The TaskID parameter specifies the task in the task queue that is to be updated.
This parameter is a single value property and is expected to be used with a pipeline of values being passed to the cmdlet as shown in Example #3
-StartingPosition
The StartingPosition parameter specifies the value at which the QueuePosition starts. The number increases for each successive task based on the -Interval parameter.
-Interval
The Interval parameter specifies the value that the QueuePosition is increase on each iteration.
