Group Policy for Defrag


M

Morley Lee

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
 
Ad

Advertisements

P

Paul Williams [MVP]

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.
 
B

Bill

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.
 
R

Robert Dorn

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
 
Ad

Advertisements

Joined
Jul 24, 2010
Messages
1
Reaction score
0
My Defragmentation Setup Script

Here's the code I just implemented on one of my networks:

Code:
 @echo off
 echo Checking Defragmentation Settings...
 at \\127.0.0.1 | findstr /il "defrag.exe" > nul
 if %ERRORLEVEL% EQU 0 GOTO DefragSetup
 
 echo Setting up Defragmentation Schedule...
 at \\127.0.0.1 20:00:00 /every:1,10,20 defrag.exe C:
 
 :DefragSetup
 echo Defragmentation of Hard Disk is Scheduled.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DFS group policy 0
Group (Doamin) Policies 0
group policy objects 0
Group Policy - File System 1
Defrag 1
defragment 0
defrag 1
defrag 1

Top