HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction Select Enable from the list on the right. Right on it and select Modify. Change the value to Y to enable and N to disable. Reboot your computer.
Tip: Copy and paste the following lines into a Notepad file and save it with a VBS extension. Create your scheduled task to run the VBS file you just saved. This will need an Adminstrator level account user name and password for the task.
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim fso, d, dc Set fso = CreateObject("Scripting.FileSystemObject") Set dc = fso.Drives For Each d in dc If d.DriveType = 2 Then Return = WshShell.Run("defrag " & d, 1, TRUE) End If Next
Use the scheduler and run chkdsk with the automatic switches for unattended operation (chkdsk /? will list the options for you). To open Scheduled Tasks, click Start, click All Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks.
You can also use TweakUI to automatically login if you have logged off the system to allow chkdsk access.
Running Disk Defragmenter Requires Administrator Privileges
Although any user can gain access to the Disk Defragmenter console, the ability to analyze or defragment a volume requires administrator privileges. If you do not have administrator privileges and you try to use Disk Defragmentor, you may receive the following message: Disk Defragmenter - You must have Administrator privileges to defrag a volume.
Disk Defragmenter was designed primarily for stand-alone workstations or servers whose users have the ability to log on locally with administrator privileges.
Disk Defragmenter is not intended to be a tool for administrators to maintain networked workstations. This version is not designed to be run remotely and cannot be scheduled to automatically defragment a volume without interaction from a logged-on user. The only way a non-administrator can defragment a local volume is to run the Dfrg.msc console in the context of a user who has administrator privileges. You can accomplish this by running the following command:
The user is prompted for the administrator password. This command may be useful for an administrator who wants to run a defragmentation on a user's computer without forcing the user to log off.
Provide Event Logging for Disk Defragmenter Utility with WSH
This discusses how to provide event logging for the Disk Defragmenter (Defrag.exe) utility with Windows Script Host. This command-line Disk Defragmenter utility that is included with Microsoft Windows XP enables administrators and power users to schedule, and, if needed, to script their operations. More information here.
Description of the New Command Line Defrag.exe in Windows XP
The Defrag.exe command line utility locates and consolidates fragmented boot files, data files, and folders on local volumes.
When you are saving files, the file is not necessarily saved as an entire file or folder in a contiguous space. The files are saved in the first available space on a volume. After a large portion of the volume has been used for file and folder storage, most of the new files are saved in pieces across the volume. When you delete files or folders, the empty spaces left behind fill in randomly as you store new ones.
You can find the Defrag utility, Defrag.exe, in the %SystemRoot%\System32 folder. It is specifically designed for scripting, and for use by system administrators.
You can defragment disk volumes formatted as FAT, FAT32, and NTFS. Defrag also works with Dynamic as well as Basic Disks.
Note: The volume must have at least fifteen percent free space for Defrag to completely and adequately defragment it. Defrag uses this space as a sorting area for file fragments. If a volume has less than fifteen percent free space, Defrag only partially defragments it.
Disk Defragmenter Is Not Displayed in the MFU List
In Microsoft Windows XP, the Disk Defragmenter utility (Defrag.exe) is not displayed in the Most Frequently Used (MFU) list on the Start menu even if it is used often.
Disk Defragmenter is a snap-in in the Microsoft Management Console (MMC); snap-ins are not reported in the MFU list.
"Drive's Contents Have Changed: Restarting..." Defragmenting
When you use the Disk Defragmenter tool to defragment your hard disk, you may receive the following message:
Drive's Contents Have Changed: Restarting...
This issue can occur if a program (such as an antivirus program or a screen saver) is running on the drive when the Disk Defragmenter tool is running