Forum Discussion
Windows Server ScheduledDefrag Task Schedule not running
Hi Dave,
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 -$
Yes, that looks correct. Might also check the task Conditions tab and remove the checks.
- NivleeFeb 28, 2019Copper Contributor
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.
- Dave PatrickFeb 28, 2019MVP
You can find most here.
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/defrag
The $ may have to do with priority. If it runs Ok using defrag.exe -c then I'd probably go with that as acceptable.