'defrag_all.vbs - Defrags all hard disks - Can be run as a Scheduled Task '© Doug Knox - 3/29/2002 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 & " -f", 1, TRUE) End If Next Set WshShell = Nothing