Schedule Defrag through Group Policy for all domain workstations

I would like to use Group Policy to schedule defrags on all of my workstations.  I have read various other answers to this issue, but I am not very familiar with writing scripts.  Can someone give me a step-by-step process to make this happen?

Thank you!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you cant add a secheduled task via Group Policy - you can control security over scheduled task but you can actually create them

here is a link for the code that will run defrag on all drives for you though

here is a link on how to create a scheduled task via script

you may want to add a logon script that will create a scheduled task.  this is just trial and error really, GPO doesnt have the functionality yet
you also have the option of using psexec to execut the script remotely on all your machines, if you use the above file, you can create the task easily accross the board

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ITBankerAuthor Commented:
I have not responded because I have not had the time to try out Jay_Jay70's recommendations.  However, I do appreciate the attempt to answer my question and will accept the answers given.  Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.