Get-Task
Get-Task
Gets monitoring tasks.
Syntax
Parameter Set: FromCriteria
Get-Task [[-Path] <String[]> ] [[-Criteria] <String> ] [ <CommonParameters>]
Parameter Set: FromId
Get-Task [-Id] <Guid> [[-Path] <String[]> ] [ <CommonParameters>]
Parameter Set: FromMonitoringObject
Get-Task [-MonitoringObject] <MonitoringObject> [[-Criteria] <String> ] [ <CommonParameters>]
Detailed Description
Gets monitoring tasks.
Parameters
-Criteria<String>
Specifies criteria using syntax designed for use with System Center Operations Manager. Only rules that meet the specified criteria will be retrieved. To learn about the syntax, consult the SDK topic, "Criteria Expression Syntax", in the System Center Operations Manager 2007 SDK. You can find the SDK by search Microsoft Developer Network (MSDN) online at https://msdn.microsoft.com.
Aliases |
none |
Required? |
false |
Position? |
4 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Id<Guid>
Specifies the GUID of the task to retrieve.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-MonitoringObject<MonitoringObject>
Specifies the monitoring object for which to retrieve tasks. You can use Get-MonitoringObject to create an object to supply as the value of this parameter.
Aliases |
none |
Required? |
true |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Path<String[]>
Specifies the path or paths to the monitoring objects for which to retrieve tasks. To enter multiple values, separate them by using commas.
Aliases |
none |
Required? |
false |
Position? |
3 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters
Notes
- For more information, type "Get-Help Get-Task -detailed". For technical information, type "Get-Help Get-Task -full".
When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".
Examples
-------------- EXAMPLE 1 --------------
This command gets all tasks and uses Select-Object to display just the name of each of them.
C:\PS>get-task | select-object name
-------------- EXAMPLE 2 --------------
This command gets all tasks and uses Where-Object to filter for tasks in the category "maintenance" which are enabled. It then passes the results along the pipeline to Format-Table which selects the displayname property and displays the results in a tabular format.
C:\PS>get-task |
where-object {$_.category -eq "maintenance" -and $_.enabled -eq "true"} |
format-table displayname