How to use GPO to disable DiskDefrag access and Automatic Maintenance in Server 2012/2012 R2


  • I'm trying to find a way to use Group Policy to disable the ability to use DiskDefrag and also how to disable the Automatic Maintenance feature in Server 2012/2012 R2.


    Monday, May 18, 2015 8:21 PM


  • Hi,

    To disable Automatic Maintenance, you will have to open Task Scheduler  > Task Scheduler Library > Microsoft > Windows > TaskScheduler. But i did not found the group policy to disable Automatic Maintenance.

    You can make changes in Group Policy to determine when maintenance should occur, and to implement a random delay to help avoid all VMs running maintenance at the same time. To open group policy settings editor, run gpedit.msc from the run dialog. These settings are under Computer Configuration > Administrative Templates > Windows Components > Maintenance Scheduler.

    For disable the default disk defragmentation, you could try the following steps:
    Step 1:  Open a notepad and paste below command in the notepad and save it has .bat format.(Disbale.bat)
              schtasks /change /tn "microsoft\windows\defrag\ScheduledDefrag" /disable
    Step 2: Create a new GPO and Rename it has Disable default defragmentation

    And then right click on newly created  Disable Default Defragmentation group policy and click on edit
    Go to computer configuration – Policies – Windows settings – scripts(startup /Shutdown)
    Click on startup and click add and add created bat file and click ok
    Then Restart the client system and check the defragmentation 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact

    Thursday, May 21, 2015 7:01 AM