sodcalculator

10 Tech How-To

Windows 11 Task Scheduler: How to Set It Up

Guide 10-49912 · Updated · Step by step

Windows 11 includes a built-in tool called Task Scheduler that lets you automatically run programs, scripts, or tasks at specific times or when certain events happen. With it, you can launch an app at logon, run a cleanup script every Friday, or start a backup when your PC boots. This guide walks you through creating a basic scheduled task using the graphical interface—no command line needed.

What You’ll Need

  • A Windows 11 PC with administrative privileges (to create tasks that run whether you’re logged in or not).
  • The program, script, or command you want to run (e.g., an .exe, .bat, .ps1, or a Windows built-in tool).
  • If the task runs a script, make sure it works manually first.

Step-by-Step

  1. Open Task Scheduler. Press Windows + R, type taskschd.msc, and press Enter. Alternatively, search “Task Scheduler” in the Start menu and click the app.
  2. Create a new task. In the right-hand “Actions” pane, click “Create Basic Task…” to use the wizard. For more advanced options (like triggers based on events or multiple conditions), choose “Create Task…” instead. This guide uses the Basic wizard.
  3. Name and describe your task. Type a clear name (e.g., “Weekly Disk Cleanup”). A description is optional but helpful.
  4. Choose the trigger. Select when you want the task to start: Daily, Weekly, Monthly, One time, When the computer starts, or When I log on. Click Next.
  5. Set the schedule details. The options depend on your trigger. For example, if you chose Weekly, pick the start date/time, the recurrence (every 1 week), and the day(s) of the week. Click Next.
  6. Choose the action. Select “Start a program” (the most common), then click Next. You can also send an email or display a message, but these are deprecated and may not work reliably—stick with starting a program.
  7. Browse to your program or script. Click “Browse…” and select the .exe, .bat, .cmd, or other file. If the program needs arguments (like a folder path or a switch), type them in the “Add arguments” field. For example, to run a PowerShell script, you might enter: -File "C:\Scripts\cleanup.ps1" and set the program to powershell.exe. Click Next.
  8. Review and finish. Check the summary. If you want to test the task immediately, check “Open the Properties dialog for this task when I click Finish” to adjust advanced settings. Click Finish.
  9. Configure advanced options (optional). In the task’s Properties dialog (which opens automatically if you checked the box, or by right-clicking the task and selecting Properties), you can set:
    – “Run whether user is logged on or not” (requires a password or use a service account).
    – “Run with highest privileges” (for admin-level tasks).
    – Conditions like “Start the task only if the computer is on AC power.”
    – Settings like “Run task as soon as possible after a scheduled start is missed.”
  10. Test the task. Right-click the task in the list and select “Run.” Check that it executes successfully (the Status column will show “Running” then “Ready” or an error code).

Common Mistakes

  • Wrong trigger time: Forgetting to set the correct start time or recurrence can cause the task to run at an unexpected moment.
  • Not using full paths: If your program or script relies on relative paths, it may fail when run by Task Scheduler because the working directory is not set. Always use absolute paths (e.g., C:\Scripts\backup.ps1) and set the “Start in” field if needed.
  • Forgetting to enable “Run whether user is logged on or not”: If you want the task to run when you’re away, you must select this option; otherwise it only runs when you’re logged in.
  • Ignoring the “Run with highest privileges” box: Many system-level tasks (like defragmentation or cleaning temp files) require admin rights. If you don’t check this, the task may fail with access denied.
  • Not testing the task: Creating a task and assuming it works without a manual run is a recipe for silent failures.

Tips

  • Use the “Start in” field: For scripts that need to access files in their own folder, set “Start in” to that folder (e.g., C:\Scripts). This prevents path errors.
  • Add a log or output file: If your program supports it, redirect output to a file so you can verify it ran. For example, in a batch script, add >> "C:\Logs\task.log" 2>&1.
  • Set “Run task as soon as possible after a scheduled start is missed”: This is under Settings in the task’s Properties. It ensures the task runs even if the PC was asleep or off at the scheduled time.
  • Use triggers wisely: For recurring tasks, consider “At startup” or “At log on” if the exact time isn’t critical—this avoids missed runs when the PC is off.
  • Export your task: Right-click the task and choose “Export…” to save it as an XML file. This makes it easy to back up or import on another machine.

Troubleshooting

  • Task doesn’t run at all: Check the “Last Run Result” column in Task Scheduler. A code like 0x41303 means the task was missed; 0x2 means the system cannot find the file. Verify the path to your program is correct and that the file exists.
  • Task runs but the program fails: If the program opens and closes instantly, it may be crashing. Run the program manually with the same arguments to see the error. Also check the “History” tab in Task Scheduler for detailed event logs.
  • Task runs at the wrong time: Double-check the time zone and the “Synchronize across time zones” option in the trigger settings. Also, if the PC was asleep, the task may run when it wakes—enable “Wake the computer to run this task” if needed.
  • Task runs when you don’t want it to: If you set multiple triggers accidentally, remove the unwanted ones in the task’s Properties → Triggers tab.
  • Access denied errors: If the task needs admin rights, check “Run with highest privileges.” Also, if the task runs under a user account that has been changed or removed, update the account in the General tab.
  • Task is disabled: Right-click the task and select “Enable” if it shows as disabled. This can happen if you imported a task that was disabled, or if Windows disables it after a failed run (rare).

Frequently Asked Questions

Can I schedule a task to run every few minutes?

Yes. In the Basic Task wizard, choose “Daily” and set the recurrence to 1 day, then in the task’s Properties → Triggers tab, edit the trigger and check “Repeat task every” and set it to 5 minutes or whatever interval you need.

How do I run a PowerShell script as an admin?

Set the program to powershell.exe, add arguments -ExecutionPolicy Bypass -File "C:\path\script.ps1", and check “Run with highest privileges” in the task’s Properties.

Why does my task run only when I’m logged in?

By default, tasks run only when the user is logged on. To change this, open the task’s Properties and select “Run whether user is logged on or not.” You’ll need to enter the user’s password (or use a service account).

Can I schedule a task to run when a specific event occurs?

Yes. Use “Create Task…” (not the Basic wizard) and in the Triggers tab, select “On an event” and specify the event log, source, and event ID.

How do I stop a scheduled task from running?

Right-click the task and select “Disable” to temporarily stop it, or “Delete” to remove it permanently. You can also end a currently running task by right-clicking and selecting “End.”

Can I make a task run on a remote computer?

Task Scheduler can be connected to another computer via “Action” → “Connect to Another Computer.” You’ll need appropriate permissions, and the remote PC must be accessible on the network.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →