Thursday, August 26, 2010

Create a defragmentation scheduled task in Windows Server 2008

Windows Server 2008 introduces a new extension of Group Policy that allows scheduled tasks to be deployed via a Group Policy Object (GPO). In the case of disk defragmentation, you can configure a GPO to run a defragmentation task. We have to borrow the scripting options from the built-in task, specifically the %windir%\system32\defrag.exe command coupled with the -c parameter.

You configure scheduled tasks through GPOs in the Computer Configuration | Preferences | Control Panel Settings | Scheduled Tasks section of the Group Policy editor (Figure A).


Figure A


Once the scheduled task is made via the GPO, it is located in a different area of the Task Scheduler (taskschd.msc) snap-in compared to the built-in task from the default installation. The GPO tasks will appear above the Microsoft folder in the root of the Task Scheduler Library folder (Figure B).

Figure B


Pushing a defrag task out with a GPO, on the one hand, is good because it ensures a consistent configuration deployed quickly; on the other hand, it may be risky to launch a series of tasks that would send a burst of I/O on the storage system. If this mechanism is selected, here are guidelines for deploying GPOs for defrag:


  • Go very granular in the organizational unit structure with different schedules to distribute the workload.
  • Consider running this on client PCs.
  • Be aware of multiple iterations of defragmentation where SANs are in use.
  • Consider consolidated effects of virtual machines.

Do you feel that defragmentation tasks should be centrally managed via Group Policy or local on each server? Share your comments in the discussion.

No comments:

Post a Comment