Scripts and Group Policy

timbrigham

Junior Member
Jun 15, 2005
20
0
0
I?m trying to set up some method where I don?t have to go to every individual machine to defrag the hard drive, preferably using the windows defrag c: command. Is there an easy way to do this in group policy or the like, where I could have a script of my creation run over the network every Friday night?
 

Brazen

Diamond Member
Jul 14, 2000
4,259
0
0
I don't know about setting a specific time, but you can assign scripts in Group Policy for when Windows starts or shuts down, and for when users log on or log off.
 

dphantom

Diamond Member
Jan 14, 2005
4,763
327
126
Group policy is initiated by a logon/off action. So having a script in place in a GPO will do nothing for you in this case without some user intervention

You could use Windows Task scheduler to do this. Scheduled Tasks in XP. Now all you need to make sure is your users leave the PC on.
 

Brazen

Diamond Member
Jul 14, 2000
4,259
0
0
You might be able to create one scheduled task on a computer to do the defrag and then copy the task from the Scheduled Tasks folder to a file share. Then you could create a script that copies that from the file share in to the scheduled tasks and assign the script through Group Policy to run at logon, logoff, startup, or shutdown - whichever you prefer - for every computer in the domain.

I haven't tried copying scheduled tasks before, but it might work.
 

NogginBoink

Diamond Member
Feb 17, 2002
5,322
0
0
Originally posted by: dphantom
Group policy is initiated by a logon/off action. So having a script in place in a GPO will do nothing for you in this case without some user intervention

You could use Windows Task scheduler to do this. Scheduled Tasks in XP. Now all you need to make sure is your users leave the PC on.

You can also assign machine startup/shutdown scripts via group policy. These are not tied to logons or logoffs.

A scheduled task is probably your best bet tho. I don't know if there's an easy way to add that via GPO.
 

dphantom

Diamond Member
Jan 14, 2005
4,763
327
126
Originally posted by: NogginBoink
Originally posted by: dphantom
Group policy is initiated by a logon/off action. So having a script in place in a GPO will do nothing for you in this case without some user intervention

You could use Windows Task scheduler to do this. Scheduled Tasks in XP. Now all you need to make sure is your users leave the PC on.

You can also assign machine startup/shutdown scripts via group policy. These are not tied to logons or logoffs.

A scheduled task is probably your best bet tho. I don't know if there's an easy way to add that via GPO.

Correct, forgot to mention that. But I agree a scheduled task is probably best in this case.

Good catch.
 

spyordie007

Diamond Member
May 28, 2001
6,229
0
0
How about writing a script that uses AT to schedule the disk defragmenter with task scheduler and than pushing that as a startup script with a GPO?

Anyway it seems a bit unneccisary to push out a script causing machine defrags; but you could do it if you really wanted.