Tech Support > Microsoft Windows > Windows Server > Group Policy for Defrag
Group Policy for Defrag
Posted by Morley Lee on March 20th, 2006


I want to see if there is a way to create a group policy to run defrag on
all the Windows XP pc's in a Windows 2003 network. Instead of going to each
pc and setting up a new task schedule.

Any help would be greatly appreciated.

Thanks,
Morley



Posted by Paul Williams [MVP] on March 20th, 2006


Without implementing additional third-party extensions, if such exist, you
could configure a start-up script that schedules a defrag or distribute a
script that you package up that schedules or initiates a defrag. The former
will be easier.

Both will need to set a timer or schedule, as both run on start-up. User
assignment/ publishing won't help as you can't guarantee users will initiate
it.

Tools such as SMS are better suited to such a task.

--
Paul Williams
Microsoft MVP - Windows Server - Directory Services
http://www.msresource.net | http://forums.msresource.net


Posted by Bill on March 20th, 2006


Here's how I'd do this:

1) Create a share that every computer in the domain can access.

2) There are two commands we need to use here. AT will schedule the job.
(at /? will list all of the options.) DEGRAG will run the disk defragmenter
from the command line. Write a batch script which runs DEFRAG using the AT
command at some specified interval. Something like: at \\127.0.0.1 12:00:00
/every:1 defrag c:

This will schedule a defrag on the 1st of the month at noon on the C:
volume, on "localhost" (\\127.0.0.1)

Save this as a BAT or CMD file and place it in your share created in step 1.

3) In GPMC, add this batch file to Computer configuration>>Windows
Settings>>Scripts>>Startup section. The next time the computer boots, it
will run this startup script and add the job to the task scheduler.

"Morley Lee" <morleyl@netsys-tech.com> wrote in message
news:%23PGoNSGTGHA.5436@TK2MSFTNGP10.phx.gbl...


Posted by Robert Dorn on March 21st, 2006


What I did i wrote a batch file and assigned it to computer scripts startup...i used the schtasks command....at a command prompt type in schtasks /? then schtasks /create /?


schtasks.exe /create /SC WEEKLY /D SAT /TN fragme /TR "\"C:\windows\system32\defrag.exe\"c: -f" /ST 00:45:00 /SD 02/22/2005 /RU SYSTEM

same can be done to auto reboot machines

schtasks.exe /create /SC DAILY /TN rebootme /TR "\"C:\windows\system32\shutdown.exe\"-f -r" /ST 04:45:00 /SD 02/22/2005 /RU SYSTEM


Similar Posts