Jump to content

Automatic DEFRAG once a month?


Recommended Posts

I would like to run a DEFRAG once a month on computers in an OU, is there an easy way to get this done? It would be at a time where nobody is around; I think it would then need to run as an elevated user.

Any ideas would help

Link to comment
Share on other sites


  • 2 months later...

Basically create a new gpo, in machine configuration, windows parameters, scripts, startup, and it's there that you'll put the batch script.

This batch script must create the scripts needed to run the defrag and then add the task with the at command for example.

Example for batchs that will create a batch file and then add the scheduled task:

echo defrag c: /f >%systemroot%\autodefragc.cmd
at 01:00 /every:01 %systemroot%\autodefragc.cmd

This should work. Anyway i've never tried this, but this is the way i'll do things.

Link to comment
Share on other sites

Basically create a new gpo, in machine configuration, windows parameters, scripts, startup, and it's there that you'll put the batch script.

This batch script must create the scripts needed to run the defrag and then add the task with the at command for example.

Example for batchs that will create a batch file and then add the scheduled task:

echo defrag c: /f >%systemroot%\autodefragc.cmd
at 01:00 /every:01 %systemroot%\autodefragc.cmd

This should work. Anyway i've never tried this, but this is the way i'll do things.

OK. I kinda get the idea. I've attached a screen shot from an XP virtual machine (I will really be using it for Win2k server). Am I going in the right direction?

Thanks

post-29225-1156366741_thumb.jpg

Link to comment
Share on other sites

You do not need to create autodefragc.cmd it will be created by script.cmd on each computer. Other than that, it should work.

OK. I've done what you've said, and I've attached a picture of what I've got. I set it on my Win2000 Active Directory Server. I set the script in "gpedit.msc > Local Computer Policy > Computer Configuration > Windows Settings > Scripts (Startup/Shutdown)"

But it doesn't go out to the whole network.

There is a command to define a single remote computer...

\\computername	 Specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.

So... The AT command is only setting the script to run on the local computer. I would like to schedule this for every computer in our network:

at 1:30 /every:Su %systemroot%\autodefragc.cmd

:)

post-29225-1157054394_thumb.jpg

Edited by 1boredguy
Link to comment
Share on other sites

  • 5 weeks later...

Im a bit lost here but where did autodefragc.cmd come from or what is it doing?

thx

P.S in answer to your question i dont think you will have a huge problem adding many task to log on/off. Only thing im aware it may slow down there log on/off depending on the tasks at hand

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...