Re: Schedule Task
- From: Owen Williams <Owen@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 21 Jun 2006 22:24:18 -0400
Yes, this is possible. I do it with my own server and with my clients'
servers. First, here is a sample script. Adapt as necessary - your
mileage may vary (note that some lines are wrapped by the newsreader -
you will need to unwrap them):
- - - - -
:: Hard Disk Defragmentation Script
:: Author: Owen Williams
:: As of: 18-Jan-2005
::
:: Set DateDay environment variable to the current date & day, e.g.,
:: 20040518-Tue
::
For /F "Tokens=1-4 Delims=/ " %%i In ('Date /T') Do
Set DateDay=%%l%%j%%k-%%i
ChDir %SBSProgramDir%\Support\Defrag Logs
Echo Hard Disk Defragmentation Report for %DateDay%
>SBSDefrag%DateDay%.log
Echo Defragmentation Results for Drive C >>SBSDefrag%DateDay%.log
Defrag C: -v >>SBSDefrag%DateDay%.log
Echo Defragmentation Results for Drive D >>SBSDefrag%DateDay%.log
Defrag D: -v >>SBSDefrag%DateDay%.log
::
:: Clean up the %SBSProgramDir%\Administration\Defrag Logs folder so
:: it contains only the most recent 4 log files.
::
:: Dir SBSDefrag*.log /B /O:-N >LogFiles.txt - Sends a list of
:: SBSDefrag file names only (/B) sorted in descending order
:: (/O:-N) to LogFiles.txt
:: For /F "Skip=4" %%f In (LogFiles.txt) Do Del %%f - Skips the first 4
:: lines of LogFiles.txt (i.e., skips the 4 newest SBSDefrag files),
:: then deletes any older files.
::
Dir SBSDefrag*.log /B /O:-N >LogFiles.txt
For /F "Skip=4" %%f In (LogFiles.txt) Do Del %%f
Del LogFiles.txt
- - - - -
Save the script in a file, e.g., SBS_Defrag.CMD.
Then, launch Start | All Programs | Accessories | System Tools |
Scheduled Tasks. Double-click Add Scheduled Task and browse to
SBS_Defrag.CMD. Set your scheduling specifications and you're good to
go.
Now, if you're asking "Can the scheduling be DYNAMIC and start at
various times, but only when usage is low", the answer is "no." You
need to know a day of the week and time of the day when usage will
usually be low. I usually select something like 6:30AM on Sunday
morning, but it really depends on the business. You should not schedule
a defrag to run while [1] a backup is running, [2] Exchange is running
information store maintenance or [3] a volume shadow copy is being taken
[by default on SBS, 7:00AM and 12:00noon].
-- Owen Williams
In article <C0BCD0B4-A353-424D-8165-10D46952F2CD@xxxxxxxxxxxxx>,
Terry1337@xxxxxxxxxxxxxxxxxxxxxxxxx says...
Is it possible to schedule a task to run defrag on needed drives at a certain.
time when useage is low? If so how do I set it up?
Thanks!
- Prev by Date: Reinstall ISA 2004
- Next by Date: How to manually remove exchange from SBS 2003
- Previous by thread: Reinstall ISA 2004
- Next by thread: RE: Schedule Task
- Index(es):
Relevant Pages
|