Keep ScheduledDefrag on its normal weekly cadence and use 20% fragmentation as an internal investigation threshold—not as a Microsoft-defined requirement—while diagnosing why this device is missing scheduled maintenance.
Fragmentation policy
Microsoft does not document a universal fragmentation percentage at which an HDD must be defragmented. Windows normally evaluates and optimizes drives weekly, and the appropriate operation depends on the media type: HDDs are defragmented, while SSDs are normally trimmed ^1^.
A practical policy for this workload would be:
- Schedule: Weekly.
- Warning threshold: 20% after a fresh analysis.
- Action: Run optimization at 20%, or earlier if storage latency or application performance deteriorates.
- Escalation: Investigate if fragmentation returns quickly after successful optimization, optimization fails, or the percentage remains high afterward.
- Free-space requirement: Maintain at least 15% free space. Below that,
defrag may only partially optimize the volume because it lacks sufficient sorting space ^1^. Do not confuse this 15% free-space prerequisite with a fragmentation threshold.
With growth of approximately 4% per week, waiting for 25% would allow roughly six weeks of accumulation. A weekly schedule is preferable to a monthly percentage-only trigger.
Power and idle requirements
ScheduledDefrag runs as a maintenance task. Microsoft identifies these common reasons it does not process every volume:
- The task does not wake the computer.
- It does not run while the computer is on battery.
- Maintenance can stop when the computer resumes from idle or a user begins interacting with it ^1^.
Automatic Maintenance runs during idle opportunities, normally on AC power, and pauses when user activity resumes ^2^.
For this device:
- Keep it powered on and connected to AC power across the maintenance window.
- Configure the power plan so it does not sleep before or during that window.
- Leave it genuinely idle—avoid monitoring, kiosk, management, or application activity that continuously generates user or CPU activity.
- Do not depend on wake-to-run for
ScheduledDefrag; arrange an awake maintenance window instead.
- In Defragment and Optimize Drives → Change settings, retain Weekly and select the required volumes. Windows also provides an option to increase frequency after three missed runs ^3^.
Using an HDD is not itself a reason for the task to be skipped. HDDs are the media type on which traditional defragmentation is expected. Power state, insufficient idle time, volume eligibility, low free space, or a missed/failed task must be distinguished using the evidence below.
- Open Task Scheduler → Task Scheduler Library → Microsoft → Windows → Defrag → ScheduledDefrag.
- Record:
- Status
- Last Run Time
- Last Run Result
- Next Run Time
- Conditions and Settings
- Enable All Tasks History if history is disabled, then inspect the task’s History tab.
- A result of
0x0 means the task launched successfully; it does not prove that every volume required or received optimization ^4^.
- Open Event Viewer → Applications and Services Logs → Microsoft → Windows → Defrag → Operational. Enable the log if necessary. Check events at the ScheduledDefrag run time.
- Also export Applications and Services Logs → Microsoft → Windows → TaskScheduler → Operational. Microsoft specifically requests this log and the task’s exported XML when diagnosing tasks that do not run ^5^.
- For Automatic Maintenance wake scheduling, inspect TaskScheduler/Maintenance; Event ID 808 identifies an application requesting wake-up during the next regular maintenance run ^6^.
Run the following from an elevated Command Prompt, replacing C: if needed:
defrag C: /A /U /V > C:\Temp\defrag-analysis.txt
fsutil dirty query C: > C:\Temp\dirty-state.txt
schtasks /query /tn "\Microsoft\Windows\Defrag\ScheduledDefrag" /v /fo LIST > C:\Temp\ScheduledDefrag.txt
powercfg /waketimers > C:\Temp\waketimers.txt
powercfg /requests > C:\Temp\power-requests.txt
/A performs analysis, /U displays progress, and /V provides detailed statistics. A dirty volume cannot be defragmented until its file-system condition is addressed with chkdsk ^1^.
Collect the task XML by right-clicking ScheduledDefrag → Export, plus:
- The two
.evtx logs above
-
defrag-analysis.txt
-
dirty-state.txt
-
ScheduledDefrag.txt
- Power reports
- Windows Server IoT edition, build number, drive model/media type, file system, capacity, and free-space percentage
These artifacts distinguish a missed idle/AC opportunity from a task trigger failure, an ineligible volume, or an optimization operation that ran but found no work.
References
- defrag
- Automatic Maintenance
- Defragment / optimize your data drives in Windows | Microsoft Support
- Windows Server IoT disk defragmentation - Microsoft Q&A
- Troubleshoot issues with scheduled tasks not running
- Desktop wakes up unexpectedly from sleep or hibernation