Home

Windows Server ScheduledDefrag Task Schedule not running

%3CLINGO-SUB%20id%3D%22lingo-sub-356798%22%20slang%3D%22en-US%22%3EWindows%20Server%20ScheduledDefrag%20Task%20Schedule%20not%20running%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-356798%22%20slang%3D%22en-US%22%3E%3CP%3EAll%20my%20Windows%20server%20(2008%20R2%20and%20above)%20unable%20to%20run%20scheduled%20task%20of%20disk%20defragmentation%3F%20I%20had%20turn%20on%20the%20schedule%20defragmentation%20in%20disk%20defragmenter%20and%20set%20it%20run%20on%20weekly%20basic%2C%20but%2C%20it%20not%20run.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20schedule%20defragmentation%20had%20selected%20all%20drive%20to%20defragment.%26nbsp%3BBelow%20is%20one%20of%20the%20server%20schedule%20defragmentation%20sample%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F84430i516FC984B0060268%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22Scheduledtask.JPG%22%20title%3D%22Scheduledtask.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20help%20to%20solve%20this%20problem%20else%20i%20need%20to%20manual%20do%20all%20my%20Windows%20server%20disk%20defragmentation%20by%20monthly.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-356798%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-358035%22%20slang%3D%22en-US%22%3ERe%3A%20Windows%20Server%20ScheduledDefrag%20Task%20Schedule%20not%20running%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-358035%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20can%20find%20most%20here.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-server%2Fadministration%2Fwindows-commands%2Fdefrag%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-server%2Fadministration%2Fwindows-commands%2Fdefrag%3C%2FFONT%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EThe%20%3CSTRONG%3E%24%3C%2FSTRONG%3E%20may%20have%20to%20do%20with%20priority.%20If%20it%20runs%20Ok%20using%26nbsp%3B%3CSTRONG%3E%3CSPAN%20style%3D%22text-align%3A%20left%3B%20color%3A%20%23333333%3B%20text-transform%3A%20none%3B%20text-indent%3A%200px%3B%20letter-spacing%3A%20normal%3B%20font-family%3A%20'SegoeUI'%2C'Lato'%2C'Helvetica%20Neue'%2CHelvetica%2CArial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20text-decoration%3A%20none%3B%20word-spacing%3A%200px%3B%20display%3A%20inline%20!important%3B%20white-space%3A%20normal%3B%20orphans%3A%202%3B%20float%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20background-color%3A%20%23ffffff%3B%22%3Edefrag.exe%20-c%3C%2FSPAN%3E%3C%2FSTRONG%3E%20then%20I'd%20probably%20go%20with%20that%20as%20acceptable.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-358021%22%20slang%3D%22en-US%22%3ERe%3A%20Windows%20Server%20ScheduledDefrag%20Task%20Schedule%20not%20running%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-358021%22%20slang%3D%22en-US%22%3E%3CP%3EI%20had%20removed%20the%20all%20the%20check%20inside%20the%20condition%20tab%20but%20still%20not%20defrag%20the%20drive%20when%20I%20run%20the%20task%20schedule.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20noticed%20if%20I%20change%20the%20action%20argument%20to%20defrag.exe%20-c%20only%2C%20then%20defrag%20will%20run.%3C%2FP%3E%3CP%3ECan%20I%20know%20what%20is%20the%20meaning%20of%20-h%20-k%20-g%20-%24%3F%20For%20your%20information%2C%20I%20using%20VM%20server.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357986%22%20slang%3D%22en-US%22%3ERe%3A%20Windows%20Server%20ScheduledDefrag%20Task%20Schedule%20not%20running%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357986%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20that%20looks%20correct.%20Might%20also%20check%20the%20task%20%3CSTRONG%3EConditions%3C%2FSTRONG%3E%20tab%20and%20remove%20the%20checks.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-357968%22%20slang%3D%22en-US%22%3ERe%3A%20Windows%20Server%20ScheduledDefrag%20Task%20Schedule%20not%20running%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-357968%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Dave%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20checked%20the%20event%20viewer%20log%26nbsp%3Band%20history%20in%20task%20scheduler%2C%20defrag%20schedule%20task%20had%20run.%20However%2C%20when%20we%20see%20the%20%22defragment%20and%26nbsp%3Boptimize%20drive%22%20application%2C%20it%20not%20defrag%20and%20optimize%20the%20drive.%20The%20drive%20still%20in%20high%20fragmented%20rate.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20default%20action%20of%20defrag%20schedule%20is%20correct%3F%3C%2FP%3E%3CP%3E%26nbsp%3BIt%20using%20below%20arguments%20for%20the%20defrag%3A%3C%2FP%3E%3CP%3E%25windir%25%5Csystem32%5Cdefrag.exe%20-c%20-h%20-k%20-g%20-%24%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-356958%22%20slang%3D%22en-US%22%3ERe%3A%20Windows%20Server%20ScheduledDefrag%20Task%20Schedule%20not%20running%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-356958%22%20slang%3D%22en-US%22%3E%3CP%20style%3D%22border-image-outset%3A%200%3B%20border-image-repeat%3A%20stretch%3B%20border-image-slice%3A%20100%25%3B%20border-image-source%3A%20none%3B%20border-image-width%3A%201%3B%20color%3A%20%232a2a2a%3B%20font-family%3A%20inherit%3B%20font-size%3A%2014px%3B%20font-style%3A%20inherit%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20inherit%3B%20letter-spacing%3A%20normal%3B%20list-style-type%3A%20none%3B%20orphans%3A%202%3B%20outline-color%3A%20invert%3B%20outline-style%3A%20none%3B%20outline-width%3A%200px%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%200px%200px%201em%200px%3B%20border%3A%20medium%20none%20currentColor%3B%22%3EI'd%20check%20the%20logs%20at%3B%3C%2FP%3E%0A%3CP%20style%3D%22border-image-outset%3A%200%3B%20border-image-repeat%3A%20stretch%3B%20border-image-slice%3A%20100%25%3B%20border-image-source%3A%20none%3B%20border-image-width%3A%201%3B%20color%3A%20%232a2a2a%3B%20font-family%3A%20inherit%3B%20font-size%3A%2014px%3B%20font-style%3A%20inherit%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20inherit%3B%20letter-spacing%3A%20normal%3B%20list-style-type%3A%20none%3B%20orphans%3A%202%3B%20outline-color%3A%20invert%3B%20outline-style%3A%20none%3B%20outline-width%3A%200px%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%200px%200px%201em%200px%3B%20border%3A%20medium%20none%20currentColor%3B%22%3E%3CSTRONG%3EEvent%20Viewer%5CApplications%5CMicrosoft%5CWindows%5CTaskScheduler%5COperational%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%20style%3D%22border-image-outset%3A%200%3B%20border-image-repeat%3A%20stretch%3B%20border-image-slice%3A%20100%25%3B%20border-image-source%3A%20none%3B%20border-image-width%3A%201%3B%20color%3A%20%232a2a2a%3B%20font-family%3A%20inherit%3B%20font-size%3A%2014px%3B%20font-style%3A%20inherit%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20inherit%3B%20letter-spacing%3A%20normal%3B%20list-style-type%3A%20none%3B%20orphans%3A%202%3B%20outline-color%3A%20invert%3B%20outline-style%3A%20none%3B%20outline-width%3A%200px%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%200px%200px%201em%200px%3B%20border%3A%20medium%20none%20currentColor%3B%22%3E(note%3A%20log%20may%20need%20to%20be%20%3CSTRONG%3EEnabled%3C%2FSTRONG%3E%20in%20right-hand%20pane)%3C%2FP%3E%0A%3CP%20style%3D%22border-image-outset%3A%200%3B%20border-image-repeat%3A%20stretch%3B%20border-image-slice%3A%20100%25%3B%20border-image-source%3A%20none%3B%20border-image-width%3A%201%3B%20color%3A%20%232a2a2a%3B%20font-family%3A%20inherit%3B%20font-size%3A%2014px%3B%20font-style%3A%20inherit%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20inherit%3B%20letter-spacing%3A%20normal%3B%20list-style-type%3A%20none%3B%20orphans%3A%202%3B%20outline-color%3A%20invert%3B%20outline-style%3A%20none%3B%20outline-width%3A%200px%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%200px%200px%201em%200px%3B%20border%3A%20medium%20none%20currentColor%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22border-image-outset%3A%200%3B%20border-image-repeat%3A%20stretch%3B%20border-image-slice%3A%20100%25%3B%20border-image-source%3A%20none%3B%20border-image-width%3A%201%3B%20color%3A%20%232a2a2a%3B%20font-family%3A%20inherit%3B%20font-size%3A%2014px%3B%20font-style%3A%20inherit%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20inherit%3B%20letter-spacing%3A%20normal%3B%20list-style-type%3A%20none%3B%20orphans%3A%202%3B%20outline-color%3A%20invert%3B%20outline-style%3A%20none%3B%20outline-width%3A%200px%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%200px%200px%201em%200px%3B%20border%3A%20medium%20none%20currentColor%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22border-image-outset%3A%200%3B%20border-image-repeat%3A%20stretch%3B%20border-image-slice%3A%20100%25%3B%20border-image-source%3A%20none%3B%20border-image-width%3A%201%3B%20color%3A%20%232a2a2a%3B%20font-family%3A%20inherit%3B%20font-size%3A%2014px%3B%20font-style%3A%20inherit%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20inherit%3B%20letter-spacing%3A%20normal%3B%20list-style-type%3A%20none%3B%20orphans%3A%202%3B%20outline-color%3A%20invert%3B%20outline-style%3A%20none%3B%20outline-width%3A%200px%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20padding%3A%200px%3B%20margin%3A%200px%200px%201em%200px%3B%20border%3A%20medium%20none%20currentColor%3B%22%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Nivlee
New Contributor

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:

Scheduledtask.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I need help to solve this problem else i need to manual do all my Windows server disk defragmentation by monthly. 

5 Replies

I'd check the logs at;

Event Viewer\Applications\Microsoft\Windows\TaskScheduler\Operational

(note: log may need to be Enabled in right-hand pane)

 

 

 

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.

 

 

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.

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.

 

 

Related Conversations
Extentions Synchronization
Deleted in Discussions on
3 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies