The Defrag Disk action performs an analysis or defragmentation of the specified drive.
Use the WMI Defrag Action action if you want to Analyze and Defragment drives on Vista and Server 2003
Specify the drive letter or a mount point of the volume to be defragmented
Analyzes the volume, displays a summary of the analysis report, and indicates whether you should defragment the volume
Forces defragmentation of the volume when free space is low
Displays the complete analysis and defragmentation reports. When used in combination with Analyze Only, displays only the analysis report. When used alone, displays both the analysis and defragmentation reports
This action is known not to work on 64bit editions of Windows. The defrag.exe utility appears to exist in Explorer, and running "defrag" on the command line works, but if a process tries to run "defrag.exe" via the CreateProcess Windows API it will return in an error condition because the file can't be found.
A volume must have at least 15% 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 15% free space, defrag will only partially defragment it. To increase the free space on a volume, delete unneeded files or move them to another disk.
You cannot defragment volumes that the file system has marked as dirty, which indicates possible corruption. You must run chkdsk on a dirty volume before you can defragment it. You can determine if a volume is dirty by using the fsutil dirty query command.