Software & OS

Task Scheduler on Windows: Create, Check and Fix Scheduled Tasks

Task Scheduler is the Windows tool that runs a program automatically at a set time or when something happens, such as logon, startup or idle. Open it with taskschd.msc, or create tasks from the command line with schtasks /create or PowerShell's Register-ScheduledTask.

How a scheduled task is built

Every task has the same parts, which match the tabs you see when you open one in the Task Scheduler window:

PartWhat it controlsExample
GeneralName, which account it runs as, whether it runs when that user isn't logged on, run with highest privilegesRun as alex, only when logged on
TriggersWhen it starts. Time-based (once, daily, weekly, monthly) or event-based (startup, logon, idle, an event log entry). Up to 48 per taskDaily at 08:00
ActionsWhat it runs: a program or script, with arguments and a start-in folder. Up to 32 per task, run in orderpowershell.exe -File C:\scripts\backup.ps1
ConditionsExtra requirements: only on AC power, only when idle, only on a certain network, wake the computerStart only if on AC power
SettingsWhat to do if a run is missed, fails, runs too long or is already runningStop if it runs longer than 72 hours

Tasks live in folders. Windows and installed apps keep most of theirs under \Microsoft\Windows\; on the Windows 11 machine used for this article, 180 of the 192 tasks were in that folder. Put your own tasks in the root folder or in a folder of your own, and leave the built-in ones alone unless you know what a task does.

Create a basic task in the Task Scheduler window

  1. Press Win+R, type taskschd.msc, press Enter.
  2. In the right-hand Actions pane, click Create Basic Task....
  3. Give it a name you'll recognise later, then pick a trigger: Daily, Weekly, Monthly, One time, When the computer starts, When I log on, or When a specific event is logged.
  4. Choose Start a program. In Program/script, browse to the program. Put arguments in Add arguments, not in the program box.
  5. Fill in Start in with the folder the script expects to run from. It's optional, but scripts that use relative paths fail without it.
  6. On the last page, tick Open the Properties dialog if you need settings the wizard skips (run whether logged on or not, highest privileges, repeat every N minutes).

The wizard covers simple schedules. For anything else (several triggers, repeat intervals, conditions) use Create Task... instead, which shows all five tabs at once.

Create a task with schtasks

schtasks works in Command Prompt and PowerShell and is handy for scripts. The pattern is always /sc (schedule type), /tn (task name) and /tr (what to run):

:: every day at 08:00
schtasks /create /tn "Daily backup" /tr "C:\scripts\backup.cmd" /sc daily /st 08:00

:: every 15 minutes
schtasks /create /tn "Sync check" /tr "C:\scripts\sync.cmd" /sc minute /mo 15

:: every Monday and Friday at 18:30
schtasks /create /tn "Report" /tr "C:\scripts\report.cmd" /sc weekly /d MON,FRI /st 18:30

:: at every logon (any user)
schtasks /create /tn "Mount drives" /tr "C:\scripts\mount.cmd" /sc onlogon

Details from Microsoft's reference that trip people up:

  • /sc accepts MINUTE, HOURLY, DAILY, WEEKLY, MONTHLY, ONCE, ONSTART, ONLOGON, ONIDLE and ONEVENT. /mo sets the interval within that type.
  • /st uses 24-hour HH:mm. Dates for /sd and /ed follow your regional short-date format, so the same command can fail on a machine with different regional settings.
  • /rl HIGHEST runs the task with full administrator rights; the default is LIMITED. /ru SYSTEM runs it as the SYSTEM account, which needs an administrator to create and can't show windows to the user.
  • /f overwrites an existing task with the same name without asking.
  • schtasks doesn't check that the program path exists. A typo still creates the task; it just fails at run time.

Create a task with PowerShell

The ScheduledTasks module builds the same task from objects, which is easier to read when there are several settings:

$action  = New-ScheduledTaskAction -Execute "powershell.exe" `
           -Argument "-NoProfile -File C:\scripts\backup.ps1" `
           -WorkingDirectory "C:\scripts"
$trigger = New-ScheduledTaskTrigger -Daily -At 08:00
Register-ScheduledTask -TaskName "Daily backup" -Action $action -Trigger $trigger

Register-ScheduledTask also takes -Settings (from New-ScheduledTaskSettingsSet), -Principal (which account, which run level) and -Description. Without -TaskPath, the task goes in the root folder.

List and inspect existing tasks

These are read-only and safe to run. In Command Prompt or PowerShell:

schtasks /query /fo TABLE
schtasks /query /fo LIST /v /tn "\Microsoft\Windows\Defrag\ScheduledDefrag"

Example output of the second command (shortened) on Windows 11:

TaskName:                             \Microsoft\Windows\Defrag\ScheduledDefrag
Next Run Time:                        N/A
Status:                               Ready
Logon Mode:                           Interactive/Background
Last Run Time:                        2026-10-20 09:09:56
Last Result:                          0
Author:                               Microsoft Corporation
Task To Run:                          %windir%\system32\defrag.exe -c -h -o -$
Comment:                              This task optimizes local storage drives.
Scheduled Task State:                 Enabled
Power Management:                     Stop On Battery Mode, No Start On Batteries
Run As User:                          SYSTEM
Stop Task If Runs X Hours and X Mins: 72:00:00
Schedule Type:                        On demand only

The PowerShell equivalents return objects you can filter:

Get-ScheduledTask | Where-Object State -eq 'Disabled'
Get-ScheduledTaskInfo -TaskName ScheduledDefrag -TaskPath "\Microsoft\Windows\Defrag\" |
  Format-List LastRunTime, LastTaskResult, NextRunTime, NumberOfMissedRuns

Example output:

LastRunTime        : 2026-10-20 09:09:09
LastTaskResult     : 0
NextRunTime        :
NumberOfMissedRuns : 0

What the Last Run Result codes mean

The Last Run Result column (or LastTaskResult) is either a Task Scheduler status code or the exit code of the program the task ran. Get-ScheduledTaskInfo shows it as a decimal number, so convert it to hex to look it up: '{0:X}' -f 267011 prints 41303.

CodeDecimalMeaning
0x00The program ran and exited with code 0 (success)
0x11The program exited with code 1: the task started, the program reported an error
0x41300267008Ready to run at its next scheduled time
0x41301267009Currently running
0x41302267010Disabled
0x41303267011Has not yet run
0x41306267014Last run was terminated by the user
0x8004131FAn instance of this task is already running
0x80041320Won't run because the user is not logged on
0x80041324Attempted, but a condition in the task definition prevented the run

Why a scheduled task doesn't run (and the fixes)

  • It works by hand but not as a task. Very often the working directory. Without Start in, the task does not start in your script's folder, so relative paths in your script point somewhere else. Set Start in, or use absolute paths throughout.
  • Last result 0x1 or another small number. That's your program's exit code. Run the exact command from the Actions tab in a terminal, from the same folder, and read the error. For PowerShell scripts, add -NoProfile -ExecutionPolicy Bypass -File only if your execution policy blocks the script and you trust it.
  • 0x80041320, or nothing happens at night. The task is set to "Run only when user is logged on". Switch to "Run whether user is logged on or not" (this stores the account password) or run it as a service account.
  • Skipped on a laptop. Check the Conditions tab for "Start the task only if the computer is on AC power". When it's ticked, the task silently skips runs on battery; untick it if the task should run anyway.
  • Missed because the PC was off. On the Settings tab, tick "Run task as soon as possible after a scheduled start is missed".
  • Stopped after a few days. Check "Stop the task if it runs longer than" on the Settings tab (the default limit is three days) and the trigger's expiry date.
  • Password changed. A task that stores a password stops running when that password changes or expires, and schtasks doesn't verify passwords when it creates the task. Re-enter the password in the task's properties.

To see what happened on each run, select the task and open the History tab. If it says history is disabled, click Enable All Tasks History in the right-hand pane (this needs an administrator). The same events are kept in Event Viewer under Applications and Services Logs > Microsoft > Windows > TaskScheduler > Operational.

For scripts that a task will run, see PowerShell basic commands and the CMD commands list. On Linux, the equivalent tools are cron and systemd timers; systemctl commands covers the service side.

Frequently asked questions

How do I open Task Scheduler?
Press Win+R, type taskschd.msc and press Enter. You can also search for Task Scheduler in the Start menu, or find it under Windows Tools (Administrative Tools on Windows 10). Creating tasks that run as another user, as SYSTEM or with highest privileges needs an administrator account.
Does a scheduled task run if the computer is asleep or off?
Not while it is off. A task can wake a sleeping computer only if its Conditions tab has 'Wake the computer to run this task' ticked and the power plan allows wake timers. If the computer was off at the scheduled time, tick 'Run task as soon as possible after a scheduled start is missed' on the Settings tab so it runs at the next opportunity.
How do I run a task every 5 minutes?
With schtasks: schtasks /create /sc minute /mo 5 /tn "MyTask" /tr "C:\scripts\job.cmd". In the GUI, create a daily or one-time trigger, then on the trigger tick 'Repeat task every', choose 5 minutes and set the duration to Indefinitely.
What does Last Run Result 0x1 mean?
Task Scheduler reports the exit code of the program it started, and 0x1 is exit code 1, which most programs and scripts use for 'something went wrong'. The scheduler itself worked. Run the same command by hand, in the same working directory and as the same user, to see the actual error.

Sources