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 https://github.com/barkz/PurePowerShellGuy.
Thanks,
Barkz
Just set this up as a script in our RMM environment to run against endpoints with block-level backup products, so, thank you!
Poking an old post here…
I also run a Hyper-V cluster from a Pure flash array. I am seeing some evidence that this scheduled task in the Server 2012 r2 context is not actually defrag the way we traditionally understand it. Rather it’s slab optimization intended to help reclaim large sections of unused space for thin provisioned disks. I can imagine the underlying Pure device still makes this operation meaningless, but I really can’t find any definitive guidance that accounts for all the info.
Hi Jack —
I did a post on this topic, https://www.purepowershellguy.com/?p=12471. Hope that helps.
Thanks//barkz
Anyone done with via a GPO?
Hi Chad — I have not seen this done outside of running some PowerShell or cmdline with a Startup script. Let me know if you found another way.
Example:
PS C:\> $TaskDefrag = Get-ScheduledTask -TaskName ‘ScheduledDefrag’
PS C:\> Unregister-ScheduledTask -TaskName $TaskDefrag.TaskName -TaskPath $TaskDefrag.TaskPath -Confirm:$false -ErrorAction SilentyContinue (Use so next time it is run b/c the task is deleted it won’t cause issue)
Thanks — Barkz
Thank you barkz. Its working pretty well