Task Scheduler
Cheat sheet · https://pcornel.dk/topic.php?topic=3021
Answer
Task Scheduler runs programs or scripts automatically on triggers such as a schedule, startup, logon or event, with conditions and settings controlling when and as which account they run.
Remember
- Last Run Result code explains failures.
- Account and 'run whether logged on' matter.
- Conditions can silently skip runs.
First checks
Get-ScheduledTask -TaskName <name> | fl *— task definitionGet-ScheduledTaskInfo -TaskName <name>— last run time and resultschtasks /query /tn <name> /v /fo list— details in CMDGet-WinEvent -LogName Microsoft-Windows-TaskScheduler/Operational -MaxEvents 30— task history (enable first)
Commands
schtasks- Create and manage scheduled tasks.
Verify in this order
trigger fires → conditions met → task starts under its account → action runs → result recorded
Where it usually breaks
First mismatch in definition/configuration → security context → service/task/process creation → runtime state → output/side effect → event/performance evidence; preserve identity/native error/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3021