Setting up Windows Server 2003 DEFRAG to run automatically is relatively simple:
1. Go to Control Panel -> Scheduled Tasks -> Add Scheduled Task to open the Scheduled Task Wizard and then click Next.
2. Hit the Browse button, search for the%SystemRoot%\system32\defrag.exe file and run it.
3. Choose a name and schedule and then click Next. A heavily trafficked Windows 2003 server will probably benefit from daily defragmentation; a less-trafficked server can be defragmented weekly.
4. Choose a start time — ideally when the server load will be slow.
5. Enter the username and password for a local administrator account. DEFRAG must run under the auspices of an administrator account that has the right to manage local disks. But this does not necessarily have to be a full administrator account. You can set up a specially created local account that only has disk-management privileges if you want.
6. Click Next and select “Open Advanced Properties…” and click Next again.
7. Under the Tasks tab, there are a few options that can be set. If you want to modify the DEFRAG command-line parameters, you can do so here. Generally, DEFRAG needs no parameters to run properly. The only exception is the –f switch, which forces DEFRAG to run when there is little free space. But DEFRAG shouldn’t need to be run with the –f switch as a scheduled job.
8. Click OK to approve the job.
Windows Server 2003 is now configured to automatically run the DEFRAG command-line tool based on the schedule you specified.