This guide shows you how to create a custom scan schedule for Windows Defender Antivirus, so you can pick the exact day and time for a full or quick scan without relying on the default random schedule. You’ll need to use the built-in Task Scheduler because Windows Security doesn’t expose scan scheduling directly. The steps work on Windows 10 and Windows 11.
What You’ll Need
- A PC running Windows 10 or Windows 11 (any edition).
- Administrator account access (you’ll need to approve a UAC prompt).
- Windows Defender Antivirus enabled (the built-in one, not a third-party AV).
Step-by-Step
- Open Task Scheduler. Press Win+R, type
taskschd.msc, and press Enter. Click Yes when the User Account Control prompt appears. - Create a new task. In the right-hand Actions pane, click Create Task… (not “Create Basic Task”).
- Name your task. In the General tab, type something like “Defender Scheduled Scan”. Optionally, check Run with highest privileges – this is recommended to avoid permission issues.
- Set the trigger. Go to the Triggers tab, click New…. Choose On a schedule from the “Begin the task” dropdown. Set your preferred start date and time, and frequency (daily, weekly, monthly). For weekly, tick the days you want. Click OK.
- Set the action. Go to the Actions tab, click New…. Ensure “Start a program” is selected. In the Program/script field, paste exactly:
C:\Program Files\Windows Defender\MpCmdRun.exe
In the Add arguments (optional) field, paste:-Scan -ScanType 2
Click OK. - Set conditions (optional but recommended). Go to the Conditions tab. Uncheck Start the task only if the computer is on AC power if you want it to run on battery. Uncheck Stop if the computer switches to battery power if you want it to continue. Leave “Wake the computer to run this task” checked if you want the PC to wake from sleep for the scan.
- Set settings. In the Settings tab, check Run task as soon as possible after a scheduled start is missed. Also check If the task fails, restart every and set it to 5 minutes, with up to 3 restart attempts. Click OK to save.
- Test the task. In Task Scheduler, find your task in the Task Scheduler Library. Right-click it and select Run. A command prompt window will flash – that’s normal. Wait a few seconds, then check if the scan started by opening Windows Security → Virus & threat protection → Scan options → Microsoft Defender Offline scan (not needed) – actually, just check the “Last scan” time in the main Virus & threat protection page. It should show today’s date and time.
- Verify the result. If the “Last scan” time updated, your schedule works. If not, check the task’s Last Run Result in Task Scheduler (see Troubleshooting).
Common Mistakes
- Wrong program path. On 32-bit Windows, the path might be
C:\Program Files (x86)\Windows Defender\MpCmdRun.exe. Check where your Defender folder is. - Missing the “-Scan” argument. Without it, the task does nothing. The argument is case-sensitive.
- Using “Create Basic Task” instead of “Create Task”. Basic tasks don’t let you set all the options (like “run as soon as possible after missed”).
- Not running with highest privileges. Some Defender operations need admin rights. If you get an error, check this box.
- Forgetting to enable the task. If you uncheck “Enabled” in the trigger, the task won’t run. Make sure the trigger’s “Enabled” box is ticked.
- Setting the scan time during a period when the PC is always off. If the PC is off at the scheduled time and you didn’t check “Run task as soon as possible after a scheduled start is missed”, the scan won’t happen.
Tips
- Use ScanType 2 for a full scan. The argument
-Scan -ScanType 2runs a full scan. For a quick scan, use-Scan -ScanType 1. For a custom scan of a specific folder, use-Scan -ScanType 3 -File "C:\path\to\folder". - Schedule a full scan weekly, not daily. Full scans can take hours and use CPU. A weekly full scan is usually enough; daily quick scans are lighter.
- Combine with Windows Security’s built-in scheduled scan. Windows Security has its own random schedule. To avoid double scans, you can disable that random schedule by setting the registry value
ScanScheduleTimeto a specific time, but that’s more complex. A custom task is simpler and more predictable. - Check the task history. In Task Scheduler, select your task and click the History tab to see when it ran and whether it succeeded.
- Keep Defender up to date. The scheduled scan uses the latest definitions, so make sure Windows Update is working.
Troubleshooting
- Task runs but “Last scan” doesn’t update. This usually means the scan failed. Check the task’s Last Run Result code. A common code is
0x2, which means “file not found” – check the path to MpCmdRun.exe. If it’s0x1, the program exited with an error – run the command manually in an elevated Command Prompt to see the error. - Task doesn’t run at all. Check the trigger settings – is it enabled? Is the date/time correct? Also check the Conditions tab – if “Start the task only if the computer is on AC power” is checked and you’re on battery, it won’t run. Uncheck that.
- Task runs but takes forever. Full scans are slow. That’s normal. If it’s stuck, it might be scanning a huge file or a network drive. You can change the scan type to quick.
- “Access denied” error. Make sure you’re running the task with highest privileges. Also check that the user account under “General” has the right to run the task – use “SYSTEM” or your admin account.
- MpCmdRun.exe not found. On some systems, Defender is part of the OS and the path is different. Try
C:\Program Files\Windows Defender\MpCmdRun.exefirst. If not, search for it in File Explorer (it’s usually in the same folder).
Frequently Asked Questions
Can I set a schedule directly in Windows Security?
No, Windows Security doesn’t expose a schedule option. You must use Task Scheduler as described above.
What’s the difference between ScanType 1 and 2?
ScanType 1 is a quick scan (checks common malware locations), ScanType 2 is a full scan (checks all files and running programs). Use quick for daily, full for weekly.
Will this conflict with the default random scan?
It could, but it’s not harmful. If you want to avoid double scans, you can disable the default scheduled scan by setting the registry value DisableScheduledScan to 1 under HKLM\SOFTWARE\Policies\Microsoft\Windows Defender – but that’s optional and not required.
How do I know the scan actually ran?
Open Windows Security → Virus & threat protection → look at “Last scan” under the “Current threats” section. It shows the date and time of the last scan.
Can I schedule a scan for a specific folder?
Yes, use -Scan -ScanType 3 -File "C:\path\to\folder" in the arguments. The folder path must be in quotes if it contains spaces.
Do I need to keep Windows Defender up to date for the scheduled scan to work?
Yes, the scan uses the latest definitions. If Windows Update is disabled, the scan might still run but with outdated protection. Keep Defender updated.
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
- Restart a Frozen Samsung Galaxy A12
- HomePod Stereo Pair with AirPlay 2 from iPhone
- Fix Unfortunately App Has Stopped: Step-by-Step
- Fix 0x8e5e0247 Error on Windows
- Pixel & Pixel XL No Sound: Solved?
- How to Edit Playlists on iPhone