T
Tom Brown
I am trying to schedule a weekly task to do a Defrag. Apparently this is
more difficult than I thought it would be.
From Kellys-Korner, I copied the routine (below) from Doug Knox.
But, I did as it said and scheduled the MyDefrag.vbs to run two minutes
later. I have seen no evidence that it is running in the Task Manager.
I also went to the Microsoft Windows XP Resource Kit and they talk about two
ways to run it, either with the defragmenter snap-in (dfrg.msc) or
defrag.exe from the command line. They don't mention anything about a
scheduled task.
Any clues or help?
Tom
================================================
Add a Scheduled Task:
Start/Programs/Accessories/System Tools/Scheduled Tasks/Add Scheduled Task
Add Defrag to the Context Menu (Right Click)
http://www2.cajun.net/~theriots/blk/xp_tweaks.htm.
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
Set WshShell = Nothing
Doug Knox [MS-MVP]
more difficult than I thought it would be.
From Kellys-Korner, I copied the routine (below) from Doug Knox.
But, I did as it said and scheduled the MyDefrag.vbs to run two minutes
later. I have seen no evidence that it is running in the Task Manager.
I also went to the Microsoft Windows XP Resource Kit and they talk about two
ways to run it, either with the defragmenter snap-in (dfrg.msc) or
defrag.exe from the command line. They don't mention anything about a
scheduled task.
Any clues or help?
Tom
================================================
Add a Scheduled Task:
Start/Programs/Accessories/System Tools/Scheduled Tasks/Add Scheduled Task
Add Defrag to the Context Menu (Right Click)
http://www2.cajun.net/~theriots/blk/xp_tweaks.htm.
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
Set WshShell = Nothing
Doug Knox [MS-MVP]