I am trying to figure out how to set up a scheduled defrag task with Group Policy.
I am very new to this, and I am having a great deal of difficulty determining the proper way to do this. I have looked through the knowledge base, but I have not been successful in getting anything to work properly. Im sure it is due to my lack of experience in this area.
The users I have created in AD log on to our Domain, and are placed in the local users group on the PC by default. It appears that I may be having a permission problem when I run the following bat file:
schtasks.exe /create /SC WEEKLY /D Mon /TN defrag /TR "\"C:\windows\system32\defrag.exe\"c: -f" /ST 10:35:00 /SD 04/27/2009 /RU SYSTEM
The scheduled task never gets created via the log on script when the user is in the local users group on the PC.
If I put the word pause at the end of the bat file I get the following error:
C:\>schtasks.exe /create /SC WEEKLY /D Mon /TN defrag /TR "\"C:\windows\system32
\defrag.exe\"c: -f" /ST 10:35:00 /SD 04/27/2009 /RU SYSTEM
INFO: The Schedule Task "defrag" will be created under user name ("NT AUTHORITY\
ERROR: Access is denied.
Press any key to continue . . .
If I move the user to the local admin group, the task gets created and runs with no problems. I am trying not to resort to this to solve this problem.
Should I be looking at a startup/shutdown script instead? If so what considerations do I need to take for computer accounts?
Thank you in advance,