Windows Guide ยท Automation

Windows Task Scheduler:
Setup, Configuration & Examples

A practical guide to creating scheduled tasks in Windows 10 and Windows 11: triggers, actions, conditions, security options, command-line examples, and troubleshooting tips.

โŠž Windows 10 โŠž Windows 11 โš™๏ธ Automation ๐Ÿ•’ Scheduled Tasks ๐Ÿงฉ CMD & PowerShell

What Is Windows Task Scheduler?

Windows Task Scheduler is a built-in Windows component that runs programs, scripts, commands, and maintenance actions automatically. Instead of launching the same tool manually every day, you can create a task that starts at a specific time, when you log on, when the computer starts, when the system becomes idle, or when a particular event appears in the Windows logs.

Task Scheduler is available in both Windows 10 and Windows 11. It is used by Windows itself, Microsoft components, device drivers, antivirus software, update services, backup tools, browser updaters, and many third-party applications. For administrators and advanced users, it is one of the most useful automation tools included with the operating system.

โ„น๏ธ
Good to know The Task Scheduler console is launched by taskschd.msc. You can open it from the Run dialog, Start menu, Control Panel, Computer Management, Command Prompt, or PowerShell.

Task Scheduler in Simple Terms

โฐ

Trigger

The event that starts the task, such as a schedule, logon, startup, idle state, or Event Viewer entry.

โ–ถ๏ธ

Action

What Windows should run: an executable file, a script, a PowerShell command, or another supported program.

๐Ÿ”‹

Conditions

Extra requirements such as AC power, idle time, network availability, or whether the computer can wake from sleep.

๐Ÿงพ

History

Execution records that help you understand whether the task started, finished, failed, or was skipped.

When Should You Use Task Scheduler in Windows?

Task Scheduler is useful when an action must run reliably without manual clicks. It is especially helpful for repetitive maintenance, reports, reminders, backups, cleanup scripts, and administrative routines.

Example 01

Run Maintenance Scripts

Start a cleanup, diagnostic, or log export script every day, every week, or after a user logs on.

Maintenance
Example 02

Automate Backups

Run a backup command such as robocopy on a schedule without installing a separate scheduler.

Backup
Example 03

Launch Apps or Reminders

Open a program, show a message through a script, or start a workflow at a specific time.

Productivity

Common Reasons to Create a Scheduled Task

โš ๏ธ
Important Do not disable random Microsoft tasks just because they appear in Task Scheduler. Many built-in tasks are responsible for updates, diagnostics, licenses, security checks, indexing, device setup, and Windows maintenance.

How to Open Task Scheduler in Windows 10 and Windows 11

There are several ways to open Task Scheduler. The fastest method is the Run dialog, but search, Control Panel, and command-line methods work just as well.

Method 1: Open Task Scheduler from Run

  1. Press Win + R to open the Run dialog.
  2. Type taskschd.msc.
  3. Press Enter or click OK.
taskschd.msc

Method 2: Open Task Scheduler from Windows Search

  1. Open the Start menu.
  2. Search for Task Scheduler.
  3. Click the best match result.

Method 3: Open Task Scheduler from Control Panel

Control Panel โ€บ System and Security โ€บ Windows Tools โ€บ Task Scheduler

Method 4: Open Task Scheduler from CMD or PowerShell

Open Command Prompt, PowerShell, or Windows Terminal and run the same management console command:

taskschd.msc

You can also use the Control Panel shortcut command:

control schedtasks

Task Scheduler Interface Explained

The Task Scheduler window is divided into three main areas: the task library on the left, the selected folder and task list in the middle, and the action panel on the right. Understanding these areas makes the tool much easier to use.

Area What It Does How You Use It
Task Scheduler Library Stores folders and tasks created by Windows, Microsoft components, and applications. Create your own folder, browse existing tasks, and avoid mixing personal tasks with system tasks.
Task List Shows task names, status, triggers, next run time, last run time, and last run result. Check whether a task is ready, disabled, running, or failing.
Actions Panel Contains commands such as Create Basic Task, Create Task, Run, Disable, and Export. Create, edit, test, import, export, delete, or manually start tasks.
History Tab Shows detailed task events if history is enabled. Find out why a task did not start or why it returned an error code.
โœ…
Recommended organization Create a separate folder under Task Scheduler Library for your own tasks. For example, use Task Scheduler Library\MyTasks or Task Scheduler Library\AdminScripts. This keeps custom automation separate from Windows system tasks.

How to Create a Basic Scheduled Task in Windows

The easiest way to start is the Create Basic Task wizard. It is suitable for simple schedules: run a program daily, weekly, once, when the computer starts, or when a user logs on.

Step-by-Step: Create a Basic Task

  1. Open Task Scheduler.
  2. In the right panel, click Create Basic Task.
  3. Enter a clear name, such as Daily Cleanup Script.
  4. Add a description so you can understand the task later.
  5. Choose a trigger: daily, weekly, monthly, one time, at logon, or at startup.
  6. Choose Start a program as the action.
  7. Select the executable, script host, or command you want to run.
  8. Review the summary and click Finish.

Program, Arguments, and Start In Fields

Many task failures happen because the Program/script, Add arguments, or Start in fields are filled incorrectly. Use full paths and separate the executable from its arguments.

Field Correct Example Meaning
Program/script powershell.exe The executable that Windows starts.
Add arguments -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\cleanup.ps1" Parameters passed to the executable.
Start in C:\Scripts The working directory used by the task. Do not wrap this field in quotes.
โš ๏ธ
Common mistake Do not put the entire command into Program/script. Put the executable there, and put switches, file paths, and parameters into Add arguments.

Advanced Task Scheduler Settings Explained

For more control, use Create Task instead of Create Basic Task. The advanced window gives you access to security options, multiple triggers, multiple actions, power conditions, network conditions, retries, time limits, and compatibility settings.

General Tab: User Account and Privileges

Option What It Means When to Use It
Run only when user is logged on The task runs in the visible user session. Use it for tasks that open windows, show UI, or interact with the desktop.
Run whether user is logged on or not The task can run in the background without an interactive desktop. Use it for backups, scripts, reports, and maintenance jobs that do not need a visible window.
Run with highest privileges The task runs elevated, similar to an administrator command prompt. Use it only when the command requires administrator rights.
Configure for Sets compatibility behavior for the selected Windows version. For modern PCs, choose Windows 10 or Windows 11 when available.

Triggers Tab: When the Task Starts

A task can have one or more triggers. For example, it can run every day at 9:00 and also run when a specific user logs on. Common triggers include:

Actions Tab: What the Task Runs

The most common action is Start a program. This can start a normal executable file, a batch file, a PowerShell script, a command-line tool, or a script interpreter.

Goal Program/script Add arguments
Run a batch file cmd.exe /c "C:\Scripts\job.bat"
Run a PowerShell script powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\job.ps1"
Run a backup command robocopy.exe "D:\Work" "E:\Backup\Work" /MIR /R:2 /W:5

Conditions and Settings Tabs

The Conditions tab controls power, idle, and network requirements. The Settings tab controls retries, missed runs, time limits, and what happens if the task is already running.

Useful Conditions

  • Start only if the computer is idle.
  • Wake the computer to run the task.
  • Start only if a network connection is available.
  • Run only on AC power for laptops.

Settings to Check

  • Stop the task if it runs longer than expected.
  • Run the task as soon as possible after a missed start.
  • Restart on failure.
  • Do not start a new instance if one is already running.

Practical Windows Task Scheduler Examples

The examples below show common real-world tasks. You can create them through the Task Scheduler interface or adapt the command-line examples later in this guide.

Example 1: Run a PowerShell Script Every Day

Use this setup when you want Windows to run a script automatically at the same time each day.

Task Field Value
Trigger Daily at 9:00 AM
Program/script powershell.exe
Add arguments -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\DailyReport.ps1"
Start in C:\Scripts

Example 2: Start a Program When You Log On

This is useful for programs that do not have a reliable startup option or for tools you want to run only under your Windows account.

  1. Create a new task.
  2. On the Triggers tab, choose At log on.
  3. On the Actions tab, choose the program executable.
  4. Use Run only when user is logged on if the program has a visible interface.

Example 3: Backup a Folder with Robocopy Every Night

The following setup mirrors D:\Work to E:\Backup\Work. Be careful with /MIR: it mirrors deletions too, so files deleted in the source can also be deleted in the destination.

robocopy.exe "D:\Work" "E:\Backup\Work" /MIR /R:2 /W:5 /LOG:"C:\Logs\work-backup.log"
๐Ÿšจ
Backup warning Test backup commands manually before scheduling them. A wrong source path, destination path, or mirror option can overwrite or delete files.

Example 4: Shut Down the PC at a Specific Time

To shut down a computer every night, create a scheduled task that runs shutdown.exe. This is useful for kiosks, lab computers, and home PCs that should not remain on all night.

Field Value
Program/script shutdown.exe
Add arguments /s /t 60 /c "Scheduled shutdown"

To cancel a pending shutdown before it happens, run:

shutdown.exe /a

Example 5: Restart a Service on a Schedule

For a service that occasionally needs a controlled restart, use PowerShell. Replace Spooler with the service name you actually need.

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Restart-Service -Name Spooler -Force"
โš ๏ธ
Service warning Restarting a service can interrupt printing, network access, databases, VPN clients, or other active work. Schedule service restarts only when you understand the effect.

Create Scheduled Tasks with CMD: schtasks Examples

schtasks.exe is the classic command-line tool for creating, listing, running, changing, and deleting scheduled tasks. It is useful for scripts, remote administration, and repeatable setup.

List Existing Scheduled Tasks

schtasks /Query /FO TABLE

Create a Daily Task

This example opens Notepad every day at 9:00 AM. It is safe for testing because it runs a visible built-in application.

schtasks /Create /TN "Open Notepad Daily" /TR "notepad.exe" /SC DAILY /ST 09:00

Create a Task That Runs at Logon

schtasks /Create /TN "Run My Tool at Logon" /TR "\"C:\Tools\MyTool.exe\"" /SC ONLOGON

Create a Task That Runs a PowerShell Script

schtasks /Create /TN "Daily PowerShell Report" /SC DAILY /ST 08:30 /TR "powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"C:\Scripts\DailyReport.ps1\""

Run, Disable, Enable, and Delete a Task

Action Command
Run now schtasks /Run /TN "Open Notepad Daily"
Disable schtasks /Change /TN "Open Notepad Daily" /DISABLE
Enable schtasks /Change /TN "Open Notepad Daily" /ENABLE
Delete schtasks /Delete /TN "Open Notepad Daily" /F
๐Ÿ’ก
Tip If a task is inside a folder, include the full task path in /TN. Example: /TN "\MyTasks\Daily PowerShell Report".

Create Scheduled Tasks with PowerShell

PowerShell gives you structured cmdlets for creating and managing scheduled tasks. It is easier to read and maintain than a very long schtasks command, especially when you need multiple options.

Create a Daily PowerShell Scheduled Task

$Action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File C:\Scripts\DailyReport.ps1"
$Trigger = New-ScheduledTaskTrigger -Daily -At 9:00am
$Settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -MultipleInstances IgnoreNew
Register-ScheduledTask -TaskName "Daily PowerShell Report" -Action $Action -Trigger $Trigger -Settings $Settings -Description "Runs the daily report script."

Create a Task That Runs at Startup

$Action = New-ScheduledTaskAction -Execute "C:\Tools\Agent.exe"
$Trigger = New-ScheduledTaskTrigger -AtStartup
Register-ScheduledTask -TaskName "Start Custom Agent" -Action $Action -Trigger $Trigger -Description "Starts the custom agent when Windows boots."

View and Remove a PowerShell Scheduled Task

Get-ScheduledTask -TaskName "Daily PowerShell Report"
Unregister-ScheduledTask -TaskName "Daily PowerShell Report" -Confirm:$false

PowerShell vs schtasks

Method Best For Notes
Task Scheduler GUI Manual setup, learning, checking task details. Easiest for beginners and good for visual verification.
schtasks.exe Batch files, older scripts, quick command-line setup. Compact but can become difficult to read with long arguments.
PowerShell cmdlets Reusable automation, admin scripts, readable configuration. More structured and easier to modify for complex tasks.

Task Scheduler Security and Reliability Best Practices

Scheduled tasks can run automatically and sometimes with elevated privileges. That makes them powerful, but it also means they should be configured carefully.

Useful Logging Pattern

For scripts, redirect output to a log file. This makes it easier to identify syntax errors, permission problems, missing files, and unexpected results.

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\DailyReport.ps1" *> "C:\Logs\DailyReport.log"
๐Ÿ”’
Security note A scheduled task that runs as administrator can be abused if its script file is writable by standard users. Store privileged scripts in a folder where only administrators can modify them.

Troubleshooting: Task Scheduler Not Running or Failing

If a scheduled task does not run, do not recreate it immediately. First check the task status, last run result, history, action fields, account permissions, power conditions, and whether the script works outside Task Scheduler.

Problem 1: Task Never Starts

Problem 2: Task Runs Manually but Not on Schedule

This usually means the trigger, user account, power condition, or missed-run setting is wrong. Enable Run task as soon as possible after a scheduled start is missed if the PC is often off or asleep at the scheduled time.

Problem 3: Last Run Result Shows 0x1

A 0x1 result often indicates a command-line problem, missing working directory, script error, or incorrect arguments. Check the following:

Problem 4: PowerShell Script Does Not Run

Use powershell.exe as the program and pass the script path through -File. If execution policy blocks the script, use an appropriate execution policy switch for that task.

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\MyScript.ps1"

Problem 5: Task History Is Empty

Task history may be disabled. In Task Scheduler, select Task Scheduler (Local) and click Enable All Tasks History in the right panel. After that, run the task again and review the History tab.

Problem 6: Task Scheduler Service Is Not Running

Task Scheduler depends on the Windows Task Scheduler service. You can check services with:

services.msc

On normal Windows installations, the Task Scheduler service should not be disabled.

Windows Task Scheduler FAQ

Q Is Task Scheduler available in Windows 11? โ–ผ
Yes. Task Scheduler is included in Windows 11 and works similarly to Windows 10. You can open it with taskschd.msc or by searching for Task Scheduler in the Start menu.
Q What is the difference between Create Basic Task and Create Task? โ–ผ
Create Basic Task is a simplified wizard for common schedules. Create Task opens the advanced editor with more control over security options, triggers, actions, conditions, retries, idle behavior, and multiple actions.
Q Can Task Scheduler run a task when the computer is sleeping? โ–ผ
It can wake the computer only if the task is allowed to wake the PC and wake timers are allowed by the active power plan. On laptops, battery settings can also prevent the task from starting.
Q Why does my scheduled task not show a window? โ–ผ
If the task is configured to run whether the user is logged on or not, it usually runs in a non-interactive background session. For visible programs, use Run only when user is logged on.
Q Is it safe to delete tasks from Task Scheduler? โ–ผ
Delete only tasks you created or tasks you clearly understand. Do not remove Microsoft or driver-related tasks randomly. If you are unsure, disable a task temporarily or export it before making permanent changes.
Q Can I export a scheduled task and import it on another PC? โ–ผ
Yes. Right-click the task and choose Export. On another computer, use Import Task. After importing, review paths, user accounts, passwords, drive letters, and permissions because they may differ between PCs.

๐Ÿงฉ Summary

Windows Task Scheduler is one of the best built-in tools for automating work in Windows 10 and Windows 11. Use it to run scripts, programs, backups, maintenance tasks, service actions, and reminders at the right time or after a specific system event.

For simple jobs, the Create Basic Task wizard is enough. For reliable automation, use Create Task, set the correct user account, separate the program from its arguments, use full paths, enable logging, and test every task manually before relying on it.