Best Practice: Disable Disk Fragmentation Scheduled Task

By default Windows Server creates a scheduled task for defrag. Connected drives from a Pure Storage FlashArray do not need this defragmentation operation performed as it wastes unnecessary cycles on the host and on the FlashArray.


To quickly disable this task run the following Windows PowerShell script. This will check the State of the task and disable as necessary.

If ((Get-ScheduledTask -TaskName 'ScheduledDefrag').State -eq 'Ready') 
    Disable-ScheduledTask -TaskName 'ScheduledDefrag' -TaskPath '\Microsoft\Windows\Defrag'
Get-ScheduledTask -TaskName 'ScheduledDefrag'

I recommend just disabling vs deleting the task.

Download script