< Back

Get-CScheduledTask

Sun Jan 12, 2020 9:53 pm

NAME Get-CScheduledTask



SYNOPSIS

Gets the scheduled tasks for the current computer.





SYNTAX

Get-CScheduledTask [[-Name] <String>] [-AsComObject] [<CommonParameters>]





DESCRIPTION

The `Get-CScheduledTask` function gets the scheduled tasks on the current computer. It returns

`Carbon.TaskScheduler.TaskInfo` objects for each one.



With no parameters, `Get-CScheduledTask` returns all scheduled tasks. To get a specific scheduled task, use the

`Name` parameter, which must be the full name of the task, i.e. path plus name. The name parameter accepts

wildcards. If a scheduled task with the given name isn't found, an error is written.



By default, `Get-CScheduledTask` uses the `schtasks.exe` application to get scheduled task information. Beginning

in Carbon 2.8.0, you can return `RegisteredTask` objects from the `Schedule.Service` COM API with the

`AsComObject` switch. Using this switch is an order of magnitude faster. In the next major version of Carbon, this

will become the default behavior.



Before Carbon 2.7.0, this function has the same name as the built-in `Get-ScheduledTask` function that comes on

Windows 2012/8 and later. It returns objects with the same properties, but if you want to use the built-in

function, use the `ScheduledTasks` qualifier, e.g. `ScheduledTasks\\Get-ScheduledTask`.





PARAMETERS

-Name <String>

The name of the scheduled task to return. Wildcards supported. This must be the *full task name*, i.e. the

task's path/location and its name.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AsComObject [<SwitchParameter>]

Return the scheduled task as a [RegisteredTask Windows COM

object](https://docs.microsoft.com/en-us/window ... steredtask), using the

`Schedule.Service` COM API. This is faster and more reliable. See [Task Scheduler

Reference](https://docs.microsoft.com/en-us/window ... -reference) for more

information.



This parameter was introduced in Carbon 2.8.0.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

Carbon.TaskScheduler.TaskInfo





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-CScheduledTask



Demonstrates how to get all scheduled tasks.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-CScheduledTask -Name 'AutoUpdateMyApp'



Demonstrates how to get a specific task.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-CScheduledTask -Name '*Microsoft*'



Demonstrates how to get all tasks that match a wildcard pattern.









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>ScheduledTasks\\Get-CScheduledTask



Demonstrates how to call the `Get-CScheduledTask` function in the `ScheduledTasks` module which ships on Windows

2012/8 and later.











RELATED LINKS

Test-CScheduledTask