batch-filewindows-7cmddefragmentation

Does anyone know of a way to turn off Windows Defragmenter's default schedule using a batch file?


I would like to use a batch file to stop Windows Disk Defragmenter from running on a schedule. By default it is enabled and I would like to disable it on Windows 7

Windows Defragmention

Right now it is turned off but you get the idea.

Does anyone know how to do this?

I have look at the command line tools for defrag.
http://www.howtogeek.com/howto/37889/dig-deeper-in-windows-defrag-via-command-prompt/
But there doesn't seem to be a option to turn it off.

Why I'm asking is because I have a large number of computer that are running ssd's. Do to there locations it would take quite a while to walk to every computer and check to make sure defrag is disabled. I can push a batch file to run on these computers easily so I am trying to find a way to disable the scheduler using the command line.


Solution

  • I found out that it is impossible to disable the defrag schedule using the command line for defrag.exe but you can just disable it using task scheduler. (Thanks Stephan)

    schtasks /Change /TN \Microsoft\Windows\Defrag\ScheduledDefrag /DISABLE
    

    This does have to run at elevated privileges.