Windows Server IoT disk defragmentation

Koh Jun Hao 0 Reputation points
2026-10-13T03:05:01.0933333+00:00

Hi,

I would like to check:

If Microsoft does not provide a fixed fragmentation percentage, could you recommend a practical threshold for our operational policy? Based on our observation, the fragmentation level increases by approximately 4% each week, which could reach around 16% after one month. Would setting the trigger threshold at 20% or 25% be reasonable, or would you recommend a different percentage?

 

Could you also advise what power settings and idle conditions should be configured for Windows Automatic Maintenance and ScheduledDefrag to run successfully?

 

For our other PCs, we did not modify the Task Scheduler settings, and automatic defragmentation still runs normally. Could you help clarify why it does not run on this particular PC? Is this behavior related to the system using an HDD, or could there be another setting or condition preventing the scheduled task from running?

 

It would also be helpful if Microsoft could advise which logs, Task Scheduler history entries, or Event IDs we should collect to identify the reason the task is not executing.

 

Windows for business | Windows Server | User experience | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Xuan Nhu 1,370 Reputation points Independent Advisor
    2026-10-13T03:14:10.8+00:00

    Dear Koh Jun Hao,

    Thank you for posting your questions to the forum community.

    20% fragmentation could be an internal investigation threshold, but it is not a Microsoft-defined requirement. Before deciding to optimize, consider the drive type, free space, disk latency, and application performance.

    You can analyze the affected volume from an administrator Command Prompt:

    defrag C: /a /v
    

    Replace C: if necessary. Microsoft documents that traditional defragmentation needs at least 15% free space to complete adequately. This is a free-space requirement, not a fragmentation threshold. Microsoft defrag documentation. learn.microsoft.com

    For ScheduledDefrag, keep the weekly schedule initially and compare its Actions, Conditions, Settings, Last Run Time, and Last Run Result with a working device running the same Windows version. Automatic Maintenance normally uses idle opportunities while the computer is on AC power, so check that the device is awake, plugged in, and able to become idle. Using an HDD does not, by itself, explain the missed maintenance. Automatic Maintenance documentation. learn.microsoft.com

    If those checks do not explain the behavior, please open a Microsoft technical support case through your organization’s Professional Support, Premier, or Unified Support arrangement, if available. Detailed analysis of this device’s scheduling and maintenance behavior is better handled in a support case, where diagnostic data can be collected and reviewed securely.

    For that case, prepare the Windows Server IoT version/build, disk details, analysis output, ScheduledDefrag task XML, and TaskScheduler Operational and Application logs covering the expected run. Avoid posting complete logs publicly.

    If this helped, I’d appreciate a Like so others can find the answer more easily.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-10-13T03:06:21.79+00:00

    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:

    1. Keep it powered on and connected to AC power across the maintenance window.
    2. Configure the power plan so it does not sleep before or during that window.
    3. Leave it genuinely idle—avoid monitoring, kiosk, management, or application activity that continuously generates user or CPU activity.
    4. Do not depend on wake-to-run for ScheduledDefrag; arrange an awake maintenance window instead.
    5. 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.

    Determine whether the task launched and performed work

    1. Open Task Scheduler → Task Scheduler Library → Microsoft → Windows → Defrag → ScheduledDefrag.
    2. Record:
      • Status
      • Last Run Time
      • Last Run Result
      • Next Run Time
      • Conditions and Settings
    3. Enable All Tasks History if history is disabled, then inspect the task’s History tab.
    4. A result of 0x0 means the task launched successfully; it does not prove that every volume required or received optimization ^4^.
    5. Open Event Viewer → Applications and Services Logs → Microsoft → Windows → Defrag → Operational. Enable the log if necessary. Check events at the ScheduledDefrag run time.
    6. 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^.
    7. 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

    1. defrag
    2. Automatic Maintenance
    3. Defragment / optimize your data drives in Windows | Microsoft Support
    4. Windows Server IoT disk defragmentation - Microsoft Q&A
    5. Troubleshoot issues with scheduled tasks not running
    6. Desktop wakes up unexpectedly from sleep or hibernation
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.