h1

Windows Admin Script: Defrag Drives Based on Threshold

April 22, 2007

I’m going to start sharing some useful scripts that I use to automate many processes. Most of the ones I will share, I have gathered from the Internet and edited. Who knows just what I will share, but I can guarantee they can help you out with many system admin tasks!

The first one I will share is a Defragment script I have implemented to run every day on many of the XP workstations I manage. Defragmentation is a big problem if not taken care of every once in a while.

What is defragmentation? When a file is saved to the hard drive, it tries to keep everything in the same location (or cluster) Over the course of time files will be deleted, leaving blank areas between files. If you install another large program, the hard drive tries to fill the holes, thus breaking up the program storage block. This effects your system performance by as much as 200% since programs have to access more areas of the hard drive, just to run.

The script I will show below is based on a threshold of fragmentation. A drive will be defragmented only if it’s fragmentation percentage is determined to be equal to or greater than the FragThreshold value. You can edit to whatever you want.

REQUIREMENTS: The script has to be executed locally on only XP or Server 2003 systems and under account with permissions to defragment local fixed drives.

Defrag All Drives

Advertisements

One comment

  1. […] Windows Admin Script: Defrag Drives Based on Threshold Originally published on Sun, 22 Apr 2007 00:05:08 GMT by […]



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: