Hi,
Here is the vbs:
' This script launches defrag and sends keys to the UI in order to automate the defrag
' process.
'
' Based on code from Windows & .Net Magazine
' Graham Reeds, 2002
' start the script and get access to the shell
set WshShell = CreateObject("WScript.Shell"
' Launch Defrag from the command line and wait for a second
WshShell.Run "dfrg.msc"
WScript.Sleep 1000
' Wait until the application has loaded - check every second
While WshShell.AppActivate("Disk Defragmenter"

= FALSE
wscript.sleep 1000
Wend
' Bring the application to the foreground
WshShell.AppActivate "Disk Defragmenter"
WScript.Sleep 500
' get the number of mounted drives
set FSysObject = CreateObject("Scripting.FileSystemObject"

set AllDrives = FSysObject.Drives'
FirstTime = TRUE
On Error Resume Next
For Each iDrive In AllDrives
If iDrive.DriveType <> 1 And iDrive.DriveType <> 3 And iDrive.DriveType <> 4 Then
If FirstTime = TRUE Then
' Send a tab key to highlight the current Drive
WshShell.Sendkeys "{TAB}"
WScript.Sleep 500
End If 'FirstTime = TRUE
' if this isn't the first time pick the next drive letter
If FirstTime = FALSE Then
' Send a down key key to highlight the next Drive
WshShell.Sendkeys "{DOWN}"
WScript.Sleep 500
End If 'FirstTime = FALSE
FirstTime = FALSE
' Send an ALT-A key to bring down the defrag menu
WshShell.SendKeys "%A"
WScript.Sleep 200
' Send a D to start the defrag for the drive:
WshShell.SendKeys "D"
' Wait until the defrag is completed - Check for window every 5 seconds
While WshShell.AppActivate("Defragmentation Complete"

= FALSE
WScript.sleep 5000
Wend
' Bring the msgbox to the foreground
WshShell.AppActivate("Defragmentation Complete"

WScript.Sleep 200
' Send a tab key to move the focus from View Report button to the Close Button
WshShell.Sendkeys "{TAB}"
WScript.Sleep 500
' Send key to Close the Defragmentation Complete window
WshShell.Sendkeys "{ENTER}"
WScript.Sleep 500
End If ' iDrive.DriveType
Next 'iDrive
' Send key to Close the Defragmentation Complete window
WshShell.Sendkeys "{ENTER}"
WScript.Sleep 500
' Send and ALT-F4 to Close the Defrag program
WshShell.Sendkeys "%{F4}"
Just set this to run at a particular time in task scheduler. May need to be adapted to run defrag on multiple drives.
Tony.