Windows 2000 Task Scheduler to the rescue
In the article Workstation maintenance the easy way I explain how you can use the Task Scheduler to schedule tasks within Windows 2000. In this article, I'll continue that theme and address some specific maintenance tasks that you can schedule through the Task Scheduler.
What needs to be scheduled?When you discuss the task of automating Windows 2000 maintenance, the first question that comes to mind is, what should be automated? You can get an idea of which tasks should be automated by looking at the automated tasks in other operating systems. Generally, you'll want to automate things like disk defragmentation, disk cleanups, and virus scans. In actuality, though, the tasks you automate are limited only by your imagination and skills.
Locating the executableThe first step to automating anything through the Task Scheduler is knowing the executable that you want to automate. In Windows 2000, tracking down an executable file is surprisingly easy. Simply navigate through the Start menu until you locate the program you want to automate. Once you've located this program, right-click on the menu shortcut and select Properties from the resulting context menu. When you do, you'll see a properties sheet containing the path and file name of the executable file. Once you know the path and file name, you can open a command prompt and try to run the program with the /? switch. For example, if you had a program called BRIEN.EXE, you could enter "BRIEN /?". In many instances, doing so will display a list of command-line options. You can use these options within the Task Scheduler to make the program behave in the desired manner when it runs automatically. The downside to Windows 2000 automation is that unlike other versions of Windows, many of the utilities that come with Windows 2000 don't support command-line switches. If the utility you need to use doesn't support command-line switches, it may be possible to write a custom script to get around it. Although I'm not a programmer by any stretch of the imagination, I do have one such script that I've written and use frequently. I'll show you an example of this script later.
Disk defragmentationOne of the most basic tasks that you may want to automate is disk defragmentation. Unfortunately, if you navigate through the Start menu to Programs|Accessories|System Tools|Disk Defragmenter and look at the properties, you'll see that this shortcut points to a Microsoft Management Console snap-in. To the best of my knowledge, there are no command-line switches that you can use with such a snap-in, although if anyone knows differently, I'd love to hear about it. I've heard rumors that if you're using FAT or FAT-32 partitions in Windows 2000, it's possible to copy the disk defragmenter program from Windows 98 and use it to automate the defragmentation process. There are also several third-party utilities available for defragmenting NTFS partitions.
Virus scansPerhaps one of the most important things to automate is your antivirus protection. Most modern antivirus programs such as Symantec's Norton AntiVirus 2000 will do this for you. The software automatically schedules periodic virus scans in addition to optionally scanning files upon access. More importantly, the software is set to automatically update itself at preset intervals. This functionality works very similarly to the Windows Update feature, except that it only updates your antivirus software.
Disk Cleanup programWindows 2000 contains a utility that can scan your hard disk and clean up old files that are no longer needed. However, like the Disk Defragmenter program, the Disk Cleanup program doesn't support command-line switches. If you know exactly what you're trying to clean up, though, this is a great place to use a script file. I've included a sample script file below. Keep in mind that this file is very general--it would be dangerous to implement this script exactly on production machines, because this file deletes unneeded files, and your needs probably differ from mine: REM Disk Cleanup Script
ERASE *.BAK /S
ERASE *.CHK /S
ERASE *.OLD /S
REM The previous three lines remove BAK, OLD, and CHK files from the root directory on the C drive. The /S after each ERASE command removes the files from all subdirectories. Exercise extreme caution when implementing such a command.
REM The line above cleans out the TEMP directory
If you'd like more information on writing such a script file, you can use any book about DOS or Windows scripting files. You can also automatically clean up old files by implementing the Remote Storage feature. Remote Storage moves files that haven't been used within a specified amount of time to an online tape drive. The files remain readily available, but don't consume hard disk space. You can find out more about remote storage by reading Setting up Remote Storage . // Brien M. Posey is an MCSE who works as a freelance writer and as the director of information systems for a national chain of health care facilities. His past experience includes working as a network engineer for the Department of Defense. Because of the extremely high volume of e-mail that Brien receives, it's impossible for him to respond to every message, although he does read them all.