Windows Server IoT Disk Defragementation Schedule task

Koh Jun Hao 0 Reputation points
2026-10-12T08:17:55.2566667+00:00

Hi ,

I would like to check with Microsoft following issue:

  1. Defragmentation trigger criteria You previously recommended considering 10–15% fragmentation, less than 20–25% free space, and sustained disk latency. For our custom defragmentation trigger, should defragmentation start when any one of these conditions is met, or only when all conditions are met? Please provide the recommended trigger logic for us to implement.
  2. Built-in ScheduledDefrag not running For our fresh Windows Server 2022 installation, we changed the built-in schedule and left the machine idle, but the scheduled defragmentation still did not run even when fragmentation was around 70%. The latest reply explains how to enable and view Task Scheduler history, but we still need guidance on how to determine why the built-in ScheduledDefrag is not executing as expected. Could you please advise what specific logs/settings/results we should provide for troubleshooting, or whether your technical team can investigate our machine with us?
  3. How to confirm fragmentation is causing performance degradation We understand how to check disk response time using Resource Monitor and PerfMon. However, we still need a clear and measurable method to determine whether fragmentation is actually the cause of the performance degradation, rather than the application, database, CPU, memory, antivirus, storage hardware, or another OS process. Please advise how we should correlate the fragmentation percentage with the PerfMon/latency results and what before/after evidence would be sufficient to conclude that fragmentation was the contributing factor.
  4. Event IDs/log messages For the event logs, could you please specify which Event IDs or messages we should look for that are relevant to defragmentation and help determine whether defragmentation ran successfully or failed? If possible, please provide an example of the expected events/messages.
  5. Fragmentation percentage versus performance For our HDD-based system, is there a recommended fragmentation percentage at which performance degradation would normally become a concern? We understand that there may not be a fixed Microsoft threshold, but we need a practical recommendation that we can use for our operational policy.
    1. Defragmentation trigger criteria
      You previously recommended considering 10–15% fragmentation, less than 20–25% free space, and sustained disk latency. For our custom defragmentation trigger, should defragmentation start when any one of these conditions is met, or only when all conditions are met? Please provide the recommended trigger logic for us to implement.
     
    1. Built-in ScheduledDefrag not running
      For our fresh Windows Server 2022 installation, we changed the built-in schedule and left the machine idle, but the scheduled defragmentation still did not run even when fragmentation was around 70%. The latest reply explains how to enable and view Task Scheduler history, but we still need guidance on how to determine why the built-in ScheduledDefrag is not executing as expected. Could you please advise what specific logs/settings/results we should provide for troubleshooting, or whether your technical team can investigate our machine with us?
     
    1. How to confirm fragmentation is causing performance degradation
      We understand how to check disk response time using Resource Monitor and PerfMon. However, we still need a clear and measurable method to determine whether fragmentation is actually the cause of the performance degradation, rather than the application, database, CPU, memory, antivirus, storage hardware, or another OS process. Please advise how we should correlate the fragmentation percentage with the PerfMon/latency results and what before/after evidence would be sufficient to conclude that fragmentation was the contributing factor.
     
    1. Event IDs/log messages
      For the event logs, could you please specify which Event IDs or messages we should look for that are relevant to defragmentation and help determine whether defragmentation ran successfully or failed? If possible, please provide an example of the expected events/messages.
     
    1. Fragmentation percentage versus performance
      For our HDD-based system, is there a recommended fragmentation percentage at which performance degradation would normally become a concern? We understand that there may not be a fixed Microsoft threshold, but we need a practical recommendation that we can use for our operational policy.

As we need to establish a clear operational approach for the deployed system, it would be helpful if you could address each of the above points directly.

Windows for business | Windows Server | Performance | System performance
0 comments No comments

1 answer

Sort by: Most helpful
  1. Chance Maurice Niyonzima 495 Reputation points Independent Advisor
    2026-10-12T08:51:23.52+00:00

    Hello Koh Jun Hao,

    Thank you for posting your question on the Microsoft Windows Forum!

    Thank you for the detailed questions. Since you're establishing an operational policy for Windows Server 2022 IoT/HDD-based systems, I'll address each point individually.

    1. Defragmentation Trigger Criteria

    I would not recommend triggering defragmentation based on fragmentation percentage alone.

    A practical trigger logic for HDDs would be:

    Start defragmentation when:
    - Fragmentation > 10–15%
    AND
    - Sustained disk latency is higher than the application's normal baseline
    OR
    - Fragmentation > 20–25% regardless of latency
    

    Fragmentation without performance impact does not necessarily justify a defragmentation run. The goal should be maintaining performance, not achieving the lowest possible fragmentation percentage.

    2. ScheduledDefrag Not Running

    Before concluding that ScheduledDefrag is malfunctioning, please collect the following:

    Step 1: Verify Task Status

    Open:

    Task Scheduler
    → Microsoft
    → Windows
    → Defrag
    → ScheduledDefrag
    

    Check:

    Last Run Result
    Last Run Time
    Next Run Time
    Task History
    

    Step 2: Verify Task Conditions

    Review:

    Task Properties
    → Conditions
    

    Check:

    Start only if idle
    Start only if on AC power
    Stop if computer ceases to be idle
    

    These conditions frequently prevent execution.

    Step 3: Run Manually

    Open an elevated Command Prompt:

    defrag C: /A
    

    Then:

    defrag C: /U /V
    

    Confirm whether manual defragmentation works successfully.

    3. How to Confirm Fragmentation Is Actually Causing Performance Problems

    This is often misunderstood.

    You cannot conclude:

    70% fragmentation = poor performance
    

    without measurements.

    Recommended Method

    Collect latency before defrag:

    Avg. Disk sec/Read
    Avg. Disk sec/Write
    Disk Transfers/sec
    

    using:

    Performance Monitor
    

    Then:

    1. Perform defragmentation.
    2. Repeat the same workload.
    3. Compare metrics.

    If:

    Fragmentation decreases
    AND
    Disk latency improves
    AND
    Application response time improves
    

    then fragmentation was likely contributing to the issue.

    Otherwise, the root cause may be:

    • CPU bottleneck
    • Memory pressure
    • Application inefficiency
    • Database contention
    • Storage hardware performance limits

    4. Relevant Event Logs

    Check:

    Event Viewer
    → Applications and Services Logs
    → Microsoft
    → Windows
    → Defrag
    → Operational
    

    Useful events include:

    Defragmentation started
    Defragmentation completed
    Volume optimization completed
    Task execution failures
    

    Please share:

    • Event ID
    • Event description
    • Timestamp

    if troubleshooting is required.

    5. Fragmentation Percentage vs Performance

    For HDD systems (not SSD):

    A reasonable operational guideline is:

    < 10% fragmentation
    → Generally acceptable
    10–20%
    → Monitor performance trends
    20–30%
    → Consider scheduled defragmentation
    > 30%
    → Defragmentation recommended
    

    A value such as:

    70% fragmentation
    

    is unusually high and would generally justify investigation and optimization, particularly if disk-intensive workloads are present.

    Additional Information Requested

    To help determine why ScheduledDefrag is not running on your Windows Server 2022 system, could you please provide:

    1. The Last Run Result from the ScheduledDefrag task.
    2. Screenshots or details from the task History tab.
    3. Output of:
    schtasks /query /tn "\Microsoft\Windows\Defrag\ScheduledDefrag" /v /fo list
    
    1. Output of:
    defrag C: /A /V
    

    These results should help determine whether the task is being skipped because of conditions, scheduler configuration, volume state, or another issue.

    For additional reference, please review:

    If the information provided was helpful, please consider clicking "Accept Answer" and consider upvoting it. Doing so helps other community members identify useful solutions to similar issues.

    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.