Hi Guys
Does anyone know of a way we can set our client PC;s to defrag on shutdown or at specifics times/dates? We would like to be able to do this via group policy or server end as we have about 2000 clients.
Thanks
Hi Guys
Does anyone know of a way we can set our client PC;s to defrag on shutdown or at specifics times/dates? We would like to be able to do this via group policy or server end as we have about 2000 clients.
Thanks

I dont think there is, we use diskkeeper to do this.
Z
defrag c: -f -v
We use these settings in a batch file to keep servers in check.
No problems in a good few years of use.
On he servers, we schedule it to be done at the weekend.

You would just copy the code into wordpad then save the file as defrag.bat
In Windows 2003 Domain i cant think off the top of my head to get it on the clients as a scheduled task. In server 2008 you can set it in group policy.
or add it as a shutdown script which was what the OP asked.
shouldnt be a problem as long as the kids dont shutdown eavery lesson


Ive been evaluating o&o defrag on my machine. Purports to do on the fly defragmenting, and also a scheduled startup defrag etc. Not sure if its something worth getting for every workstation right enough.
Big fan of JKDefrag myself. (Can be found on filehippo if you search)
Can be set to run via batch. Seems to do a far better defrag than the windows system defrag. Has plenty of flags to play with too.
Can also be set to run as the screensaver, though whether you would want such heavy disc activity so frequently is questionable.
tosh74 (13th March 2009)
Sorry for the delay, on the road this morning.
Create a batch file with the following in: -
c:\windows\system32\defrag.exe c: -f -v
shutdown -s
The batch file can be local, but restrict access to it so little people do not play.
Schedule the batch file to run, using an administrator's credentials, on the evening in question.
The script will defragment the c: the -f forces it to do so even if it is short of space and -v means verbos (no user input required).
Once defrag has completed, the PC will shut down.
If you decide to test the script, you can cancel the defrag process by pressing <ctrl>+C to cancel the batch task.
shane_saintsfc (16th March 2009)
Last edited by shane_saintsfc; 16th March 2009 at 12:29 PM.
Not so sure about getting it to run when you click on shutdown, but it's easy enough to create a shortcut to the batch file and save it in your start menu. I give it the same icon as shutdown. Might be worth telling it to run a disc cleanup before it runs a defrag too. Just add 'cleanmgr' to the batch file.

If you set it as the shutdown script in AD then it will run on shutdown no matter where you shut it down from. You could use some conditionals in the file to check to see if it is the 28th of the month and only run if it is that day which would give you the once a month thing.
AyatollahPies (17th March 2009)
There are currently 1 users browsing this thread. (0 members and 1 guests)