Use this cmdlet to get a ServiceTaskItem from the task queue.
PowerShell | ParameterSet: "Default"
Get-SyncTask
- [-TaskID]
PowerShell | ParameterSet: "IDs"
Get-SyncTask
- [-TaskIDsOnly]
PowerShell | ParameterSet: "States"
Get-SyncTask
- [-States]
Description
The Get-SyncTask cmdlet is used to retrieve information about SyncTasks in the task queue. The cmdlet does not remove tasks, and changes to the returned object does not cause changes unless the task object is used as a parameter in Set-SyncTask.
The cmdlet can get detail about a single task, can list all tasks, can list all tasks only by their TaskID values, and can list tasks that match one or more WorkStatus status values. It is common to use this cmdlet to get a list of all completed or processing tasks.
This cmdlet does not retrieve information about removed tasks. Use Show-RemovedTasks to show information about removed tasks.
Examples
Example 1
PowerShell
Get-SyncTask
This example, without parameters will list all sync tasks in all states in the task queue.
Example 2
PowerShell
Get-SyncTask -TaskID 12345678-ABCD-EF01-1234567890AB
This example will get a ServiceTaskItem for the provided TaskID, if one is found in the task queue. If no match is found, nothing is returned.
Example 3
PowerShell
Get-SyncTask -TaskIDsOnly
This example will simply list all tasks, in all states, and will only output the TaskID for each item.
Example 4
PowerShell
Get-SyncTask -States Completed, Processing
This example will filter the resulting list of ServiceTaskItem objects to only those that are either in a Completed or Processing state.
Parameters
-TaskID
This parameter uniquely identifies a specific task in the task queue. If no task matches this ID, no object is returned.
-TaskIDsOnly
This parameters is used to list all tasks by their TaskID value only.
-States
This parameter is a list of one or more WorkStatus values that filter the returned data to only those tasks that match the states requested.
The following WorkStatus values exist: Unknown, New, Unstarted, Reset, Starting, Processing, Completing, Completed, Canceled, Exited, Excluded, Removed, Error, ErrorStartingProcess
-TaskName
The TaskName parameter specifies the name or wildcard pattern of a sync task. Wildcard patterns used the same filtering as would be used for filtering files, namely the * and ? characters.
Output
This cmdlet will place one or more PSObject objects on the pipeline.
When this cmdlet is used with no parameters, the -TaskID parameter, or the -States parameter, the following properties exist on the object(s) returned:
| QueuePosition | The relative position in the task queue. Multiple objects can have the same QueuePosition, in which case they are in the order in which they were added. |
| TaskName | The name of the task. |
| StartOnOrAfter | A date value that determines the soonest at which the task engine may start the task. If not set, the task will start based on its QueuePosition |
| TaskID | The unique task ID |
| State | The WorkStatus value for the task. |
| Task | The SyncTask object. This is the type of object that New-SyncTask creates. |
When this cmdlet is used with the -TaskIDsOnly switch parameter, a list of TaskID values (Guid) is placed on the pipeline.
