After the initial install of Windows XP, the disk may need to be defragmented for optimum performance. After some time, there may need to be a reason to run disk defragmenter again to clean up fragmented files on the disk. There are eight steps in order to schedule a monthly defragging of the local hard drive and have it run silent.
- Create a batch file and name it something like Defrag.bat. On the first line add "C:WindowsSystem32defrag c:" and save the batch file. Do not use the quote marks in the command line.
- Create a new package in SMS as you would any other package (not from definition). Open the properties of the package and go to the data access tab and enter a name for the share. You can call it "WindowsDefrag" or whatever you like. Note: It does not matter how you type it, the share name is always in caps. You can set this option so that the share name on the distribution point is readable, since the default is the package ID number, which is more difficult to remember.
- Manually create a new program and call it something like "Windows XP Defrag" (no quotes). Open the properties of the new program and in the comments area, type "Silent Install." Adding the comment makes it easy when making an advertisement so you know what it does if you forget in the future.
On the Run drop-down menu, select "hidden." On the Environment tab, make sure the radio button is selected to run with administrative rights. Configure the "Program can run:" to whether or not the user is logged on. Finally, make sure "use software installation account" is check marked. Do not check mark "allow users to interact with this program."
- Add your distribution points as necessary.
- Target specified collections wherever you like for your advertisement, but for this example, we will use the All Windows XP Systems collection. Under advertisements in the SMS console, create a new advertisement.
- Give the advertisement a name such as All Windows XP Systems Defrag. Under "package," click the drop-down menu and select the Defrag package you created earlier. Select the program you created in the program drop-down box. Select the collection you want the advertisement to go to.
- Change the advertisement start time on the schedule tab to be a Friday, Saturday or Sunday at 12:00 a.m. or whenever you like. Click the yellow asterisk in the mandatory assignments box. A window will pop up, select "schedule." Select "monthly" as a recurrence pattern and recur every month on the last day of the month. You can schedule a weekly, daily or monthly pattern depending on your needs. Make sure to give a start date and time as well. You should schedule the defragging when users are unlikely to be using the computer, since the process will take some time to complete as well as take up some CPU usage.
- Notice on the schedule tab where you have the option to allow users to run the program independently of assignment. If you check this box, the users will be able to open the run advertised programs in the control panel and execute a defrag whenever they want. Decide if this is right for your organization and if this is something you want your users to be able to do.
Now that you have scheduled your defragging, you have a batch file that will kick off a disk defrag once a month. Also, if you add this to the All Windows XP Systems collection, as soon as the client is discovered, it will defrag immediately.
ABOUT THE AUTHOR: Brian Tucker has been in the IT industry for 8 years and specializes in Microsoft Back Office applications. Brian has a passion for SMS and currently is involved in a SMS 2003 deployment for a large health care organization in St. Louis.
This article first appeared in myITforum, the premier online destination for IT professionals responsible for managing their corporations' Microsoft Windows systems. The centerpiece of myITforum.com is a collection of member forums where IT professionals actively exchange technical tips, share their expertise, and download utilities that help them better manage their Windows environments, specifically Microsoft Systems Management Server (SMS). It is part of the TechTarget network of Web sites. To register for the site and sign up for the myITforum daily newsletter, click here.
This was first published in September 2004