Automating Disk Defragmentation

  • Section(s): Admin , Miscellaneous
  • Published on Jun 22, 2006.
  • Last Modified on Jun 22, 2006.
  • Last Modified by Chris Sanders.
  • Rated 4.3 out of 5 based on 16 votes.
Windows XP and Windows Server 2003 both include a new way to invoke the Windows defragmenter via the command line. This allows for easy automation of this task.
Windows XP and Windows Server 2003 both include a new way to invoke the Windows Defragmentation tool via the command line. This is different from prior versions of Windows in which there was no such command line based way to invoke this tool. Here is an example of the usage of defrag.exe:

defrag.exe -v e: >c:\temp\logfile.txt

This command will begin the Defragmentation of the target machines E: drive. The –v switch enables verbose logging of which the location is specified at the end of the command.

The biggest advantage of this new functionality is the ability to schedule disk Defragmentation via the Windows Task Scheduler. By simply creating a batch file to invoke this command you can put an end to disk Defragmentation as a manual process.

***

Chris Sanders is the network administrator for one of the largest public school systems in the state of Kentucky. Chris's specialties include general network administration, windows server 2003, wireless networking, and security. You can view Chris' personal website at www.chrissanders.org.

About Chris Sanders

Chris Sanders is a network security analyst for EWA Government Systems Inc. Chris is the author of the book Practical Packet Analysis as well as several technical articles. His personal website at www.chrissanders.org contains a great deal of information, articles, and guides related to network administration, network security, packet analysis, and general information technology.


Article not looking right or info is missing? Let us know so that we can fix it: .


Receive all the latest articles by email!

Receive Real-Time & Monthly WindowsNetworking.com article updates in your mailbox. Enter your email below!
Click for Real-Time sample & Monthly sample

Become a WindowsNetworking.com member!

Discuss your network issues with thousands of other network administrators. Click here to join!

Community Area

Log in | Register

Readers' Choice

Which is your preferred Anti Spam Hardware solution?

Follow TechGenix on Twitter