List scheduled tasks whose last run failed
Build a paste-ready command, then review its compatibility and effects before running it.
Get-ScheduledTask | Get-ScheduledTaskInfo | Where-Object LastTaskResult -ne 0 | Sort-Object LastRunTime -Descending | Select-Object TaskName,LastRunTime,LastTaskResult,NextRunTimeread-onlyno known side effects Compatibility
WindowsVerified for Windows using powershell syntax.
Operational knowledgereview due 2027-01-19
RequirementsGet-ScheduledTaskGet-ScheduledTask must be installed and available on PATH.
Version supportGet-ScheduledTask Current supported releasesVerified for windows using powershell syntax; consult compatibility notes for platform-specific differences.
Expected signalsTaskName LastRunTime LastTaskResult NextRunTimeRepresentative successful output; values vary with the selected target and system state.
Known errorsGet-ScheduledTask: command not foundGet-ScheduledTask is missing or is not available on PATH.
VerifyGet-ScheduledTask | Get-ScheduledTaskInfo | Where-Object LastTaskResult -ne 0 | Sort-Object LastRunTime -Descending | Select-Object TaskName,LastRunTime,LastTaskResult,NextRunTimeThe output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01Get-ScheduledTaskCommandRuns the Get-ScheduledTask stage of this one-liner.
02|PipelinePasses the output on the left to the command on the right.
03Get-ScheduledTaskInfoCommandRuns the Get-ScheduledTaskInfo stage of this one-liner.
04|PipelinePasses the output on the left to the command on the right.
05Where-ObjectCommandRuns the Where-Object stage of this one-liner.
06LastTaskResultArgumentPasses LastTaskResult to Where-Object.
07-neOptionConfigures Where-Object with the -ne option.
080ArgumentPasses 0 to Where-Object.
09|PipelinePasses the output on the left to the command on the right.
10Sort-ObjectCommandRuns the Sort-Object stage of this one-liner.
11LastRunTimeArgumentPasses LastRunTime to Sort-Object.
12-DescendingOptionConfigures Sort-Object with the -Descending option.
13|PipelinePasses the output on the left to the command on the right.
14Select-ObjectCommandRuns the Select-Object stage of this one-liner.
15TaskName,LastRunTime,LastTaskResult,NextRunTimeArgumentPasses TaskName,LastRunTime,LastTaskResult,NextRunTime to Select-Object.
This advanced community-curated one-liner combines several stages. Review every option and placeholder before running it.
Example input
Get-ScheduledTask | Get-ScheduledTaskInfo | Where-Object LastTaskResult -ne 0 | Sort-Object LastRunTime -Descending | Select-Object TaskName,LastRunTime,LastTaskResult,NextRunTime
Example output
TaskName LastRunTime LastTaskResult NextRunTime
-------- ----------- -------------- -----------
NightlyBackup 7/23/2026 2:00:00 AM 2 7/24/2026 2:00:00 AM
LogCleanup 7/23/2026 1:30:00 AM 2147942402 7/24/2026 1:30:00 AM
Illustrative output — exact values vary by system and data.
Official sources