LLI Wiki — My Digital Knowledge Base

List non-Microsoft Windows scheduled tasks

PowerShell script to list scheduled tasks outside the Microsoft folder with their state and last run results.

To list the scheduled tasks created by users or applications, excluding those in the \Microsoft\ folder, the following PowerShell script shows for each task its state, next run time, last run time and the result code of the last run.

Get-ScheduledTask | Where-Object { $_.TaskPath -notlike "\Microsoft\*" } |
ForEach-Object {
    $task = $_
    $info = Get-ScheduledTaskInfo -TaskName $task.TaskName -TaskPath $task.TaskPath
    [PSCustomObject]@{
        TaskPath       = $task.TaskPath
        TaskName       = $task.TaskName
        State          = $task.State
        NextRunTime    = $info.NextRunTime
        LastRunTime    = $info.LastRunTime
        LastTaskResult = $info.LastTaskResult
    }
} | Format-Table -AutoSize

Columns

Column Content
TaskPath Folder of the task in Task Scheduler
TaskName Name of the task
State Task state (Ready, Running, Disabled...)
NextRunTime Next scheduled run
LastRunTime Last run
LastTaskResult Return code of the last run (0 means success)
Mastodon LLIMastodon SocialFosstodon