Automating disk defragmentation

After you install applications on a server, running Disk Defragmenter on a regular basis will ensure they run efficiently. You can put an end to disk defragmentation as a manual process by scheduling it via the Windows Task Scheduler.

After you install a lot of applications on a server, systems administrators should run Disk Defragmenter on a regular basis so they can run efficiently. However, that may be difficult to do on timely basis because of your busy schedule.

Today, it's possible to put an end to disk defragmentation as a manual process by scheduling disk defragmentation via the Windows Task Scheduler. Windows XP and Windows Server 2003 both include a new way to invoke the Windows Defragmentation tool via the command line. (In prior versions of Windows, there was no way to invoke this tool with the Command Line.)

Here is an example of the usage of defrag.exe:

defrag.exe -v d: >c:templogfile.txt

This command will begin the Defragmentation of the target machines D: drive.

The v switch enables verbose logging of the location specified at the end of the command. Now you can create a batch file using the above command without manually performing the task of disk defragmentation.

Please let us know how useful you find this tip by rating it below! If you have a useful Windows tip, timesaver or workaround to share, submit it to our tip contest and you could win a prize!

This was first published in August 2006

Dig deeper on Microsoft Group Policy Management

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchExchange

SearchSQLServer

SearchWinIT

SearchEnterpriseDesktop

SearchVirtualDesktop

Close