PowerShell Genie

Get-ScheduledTask

Use Get-ScheduledTask to list scheduled tasks with their definitions, triggers and current state.

Command 1 min read PowerShell 7 on Windows

Documentation: Microsoft Learn — PowerShell module reference

Syntax

1PS> Get-ScheduledTask [[-TaskName] <string[]>] [-TaskPath <String[]>] [-CimSession <CimSession[]>] [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Get-ScheduledTask [[-TaskName] <string[]>] [-TaskPath <String[]>] [-CimSession <CimSession[]>] [<CommonParameters>]
  1. Stage 1Get-ScheduledTask-TaskName -TaskPath -CimSession

    Try it

    Windows PowerShell

    PowerShell example · browser support is limited.

    Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.

    Interactive simulation · fictional data

    Examples

    Get-ScheduledTask -TaskPath \

    1PS> Get-ScheduledTask -TaskPath \ | Select-Object TaskName, State
    Show reference output

    Sample output · fictional data, shaped like the real thing

    TaskName     State
    -----------  --------
    Backup       Ready
    Maintenance  Disabled

    Filter by State

    1PS> Get-ScheduledTask | Where-Object State -eq Disabled | Select-Object TaskName, TaskPath
    Show reference output

    Sample output · fictional data, shaped like the real thing

    TaskName     TaskPath
    -----------  -------------------
    Maintenance  \Microsoft\Windows\

    Get-ScheduledTask -TaskName MyTask

    1PS> Get-ScheduledTask -TaskName MyTask | Select-Object -ExpandProperty Actions
    Show reference output

    Sample output · fictional data, shaped like the real thing

    PowerShell.exe -File C:\Scripts\Backup.ps1
    maintenance.exe

    Parameters

    Parameter definitions:

    • -TaskName
    • -TaskPath
    • -CimSession

    PowerShell module reference on Microsoft Learn

    Practical use and troubleshooting

    Practical scenario: Use Get-ScheduledTask when you need to list scheduled tasks with their definitions, triggers and current state. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.

    Common error and fix: A task-not-found error can mean the task is stored under another TaskPath. Inspect both TaskName and TaskPath and target the exact registered task. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.

    See also: Get-ScheduledTaskInfo. Get-ScheduledTask returns task configuration; Get-ScheduledTaskInfo returns runtime information such as LastRunTime and LastTaskResult. An enabled task definition is not evidence of a successful last run. Read the linked command before substituting it; similar names do not imply identical inputs or output.

    Get-ScheduledTask reference on Microsoft Learn

    Recap

    Get-ScheduledTask Use Get-ScheduledTask to list scheduled tasks with their definitions, triggers and current state.

    Next: Get-Job
    Genie guideGet-ScheduledTask

    Use Get-ScheduledTask to list scheduled tasks with their definitions, triggers and current state. The console below is pre-loaded — run it, then change a value and run it again.