02-26-2019 01:58 AM
02-26-2019 01:58 AM
All my Windows server (2008 R2 and above) unable to run scheduled task of disk defragmentation? I had turn on the schedule defragmentation in disk defragmenter and set it run on weekly basic, but, it not run.
In the schedule defragmentation had selected all drive to defragment. Below is one of the server schedule defragmentation sample:
I need help to solve this problem else i need to manual do all my Windows server disk defragmentation by monthly.
02-27-2019 05:57 PM
I checked the event viewer log and history in task scheduler, defrag schedule task had run. However, when we see the "defragment and optimize drive" application, it not defrag and optimize the drive. The drive still in high fragmented rate.
The default action of defrag schedule is correct?
It using below arguments for the defrag:
%windir%\system32\defrag.exe -c -h -k -g -$
02-27-2019 06:39 PM
Yes, that looks correct. Might also check the task Conditions tab and remove the checks.
02-27-2019 07:28 PM
I had removed the all the check inside the condition tab but still not defrag the drive when I run the task schedule.
I noticed if I change the action argument to defrag.exe -c only, then defrag will run.
Can I know what is the meaning of -h -k -g -$? For your information, I using VM server.
02-27-2019 07:46 PM
You can find most here.
The $ may have to do with priority. If it runs Ok using defrag.exe -c then I'd probably go with that as acceptable.
01-05-2020 02:51 PM
@Nivlee I came across the same problem on our two Windows 2012 servers. Defrag had never been run and I suspect the reason is that there is no trigger on the ScheduledDefrag task which means it'll never run automatically. Changing the schedule in the optimisation tool from weekly to daily doesn't make any difference. I suspect this is a bug that's been around a long time...
I'm about to add a trigger to run it once a week and see what happens.
01-05-2020 03:17 PM
01-16-2020 08:20 AM
In general, some other scheduled task (don't know which) runs ScheduledDefrag. That is why its triggers are empty. I suppose, with some care, triggers could be added. It is too bad that Microsoft allows but doesn't show such cascaded schedules.
by Jose Barreto on April 10, 2019
by FileCAB-Team on April 10, 2019