Automating Computer Maintenance

I have written several posts in the past regarding regular computer maintenance. Keeping a regular maintenance schedule is important if you would like to protect yourself against viruses and spyware, as well as maintaining the computer performance. My latest post title Regular Computer Maintenance provided a tutorial on performing some standard maintenance on your computer.

In addition to the information provided in that post, there is an automated way of virus and spyware scanning as well as defragging your hard drive, all without you having to worry about it in the future. This post explains how to accomplish this.

The Tools

Before we begin to automate the maintenance tasks it is important to first introduce the tools that will help us. We will be using a virus scanner, spyware scanner, and a defrag program. The tools I have chosen are all free, and can be run from the command line, or a DOS prompt.

Unlimited data backup with BackBlaze

The tools are:

Note:

The defrag program that is included with Windows XP can also be used, but the only problem is that you can only defrag one drive at a time. JKDefrag allows you to defrag all drives with one command.

If you are using the above tools, then download and install them. For the defrag progam, just extract it to a directory as it does not come with an install program. Remember where the tools are installed since you will need to know that information in the next sections. I will be using the tools above in the next few sections, but if you chose a different tool then you will need to substitute my tool for yours.

Automating Virus Scan

The first maintenance task that we will automate will be the virus scanning. We will be running this at least once a week to ensure that there are no viruses installed.

In the examples that follow, each of the files should only contain 2 lines of code. They may wrap in this page, but there should only be two lines in each file. To automate this task, use the following steps:

  1. Open up Windows Notepad by pressing Windows Key+R to open the Run dialog. Enter notepad in the box and press OK.
  2. In the blank Notepad window, type:
    @echo off

    “C:\Program Files\Grisoft\AVG7\avgscan.exe” /MEM /LOG c:
  3. Note:

    Subsitute the location of the virus scanner into the file if it is located in a different directory than is specified here.

  4. Click File->Save and specify a directory to save the file. Remember where you save the file as you will need to know this later.
  5. In the File name box enter vscan.bat.
  6. Beside Save as type, select All files.
  7. Click the Save button to save the file.

This file will execute the virus scanner without any interaction by a user. We will schedule this later in this post, but first we will continue to create two more files to automate the other processes.

Automating Spyware Scan

The steps required to automate the spyware scanner is very similar to the virus scanner. They are outline below.

  1. Open up Windows Notepad by pressing Windows Key+R to open the Run dialog. Enter notepad in the box and press OK.
  2. In the blank Notepad window, type:
    @echo off

    “C:\Program Files\Spybot – Search & Destroy\SpybotSD.exe” /autoupdate /autoimmunize /autocheck
    /autofix /autoclose
  3. The above command will also automatically update your definitions for the application as long as you have an active Internet connection.

    Note:

    Subsitute the location of the spyware scanner into the file if it is located in a different directory than is specified here.

  4. Click File->Save and specify a directory to save the file. Remember where you save the file as you will need to know this later.
  5. In the File name box enter spyscan.bat.
  6. Beside Save as type, select All files.
  7. Click the Save button to save the file.

Automating Hard Drive Defrag

Similar to automating the previous two tasks, the defrag program will run in a similar fashion:

  1. Open up Windows Notepad by pressing Windows Key+R to open the Run dialog. Enter notepad in the box and press OK.
  2. In the blank Notepad window, type:
    @echo off

    C:\Program Files\jkdefrag\jkdefragcmd.exe” -a 3 -d 2 -q -l “defrag.log” c:
  3. If you would like to defrag more than just the C drive, simply enter the other drive letters after “c:”.

    Note:

    Subsitute the location of the spyware scanner into the file if it is located in a different directory than is specified here.

  4. Click File->Save and specify a directory to save the file. Remember where you save the file as you will need to know this later.
  5. In the File name box enter defrag.bat.
  6. Beside Save as type, select All files.
  7. Click the Save button to save the file.

Now we have our three batch files that will execute the maintenance tasks for us. We could easily execute any of the batch files and they would perform their task; however, this post is about automating, so the next part will show how to do just that.

Schedule the Tasks

To schedule the tasks we will be using the standard task scheduler that is included with Windows. To schedule the tasks do the following:

  1. Click Start Menu->All Programs->Accessories->System Tools->Scheduled Tasks.
  2. In the scheduled tasks window, double-click the Add Scheduled Task icon, and then click Next to continue.
  3. In the next window click the Browse button and then navigate to the directory that contains your virus scanner file create in the Automating Virus Scan section.
  4. Click the file, and then click the Open to select it.
  5. You should now be prompted for a name. Enter Virus Scan and then select Weekly from the options list on the screen. Click Next to continue.
  6. The next screen is where you specify when the task should run. Enter a time and select the days you want the task to run. For me I selected 1:00 AM and Saturday as my schedule. Once you enter the time and day click Next to continue.
  7. The last step prompts you for a user ID and password. The user ID specified is your current log in ID. If that user ID has enough permissions to run the program, then just enter the password associated with your ID. Leave it blank if there is no password. Once you enter the user ID and password, click Next to continue.
  8. You should now see a summary of the task. Verify that the information is correct, and click Finish to save the task.

You have now scheduled your virus scanner to run at a specific time each week. Repeat the steps again for the spyware scan and the defrag program. You may want to specify a different time to run the next two tasks to prevent your computer from slowing when running them. Make sure you change the names of the new tasks to reflect what they are doing.

For me, the remaining tasks were scheduled as the following:

  • Spyware Scan – 4:00 AM Saturday
  • Defrag – 1:00 AM Sunday

Summary

This post explained how to schedule three of the important computer maintenance tasks that you need to perform. The three tasks will automatically execute once a week at a time when my computer is rarely in use so it won’t impact me when I’m using the computer.

Most virus and spyware scanning, and defrag applications include a built-in scheduler, but the difference is that the applications used in this post cost nothing to use and can easily be schedule through the Windows Task Scheduler.

PG

About Paul Salmon

Paul Salmon is the founder of Technically Easy. He is a an experienced PC user, and enjoys solving computer-related problems that he encounters on a regular basis.

Facebook | Twitter | Google+

Opt In Image
Get Microsoft Office 365
Your cloud-powered, complete office solution.

Multiple Devices.
Use Office 365 on 5 PCs or Macs, plus 5 iPads or Windows tablets.

Massive cloud storage.
Up to 5 people can have 1TB of cloud-storage.

Skype calls.
Get 60 minutes of Skype calls per month.

Non-stop updates.
Cloud-powered Office 365 provides ongoing updates.

 

Security, Security Tips, Windows

7 Comments

  1. J.BB
    Posted July 10, 2011 at 7:27 pm | Permalink

    Thanks for the great article! Its totally true. Its all about keeping your catches clean. I use P.C Tune up Maestro ( http://compuclever.com/products/pc-tuneup-maestro/ ) To keep cleaning my registry without getting rid of the important stuff.
    Thanks again for the article!

  2. Gabriel Walker
    Posted October 6, 2010 at 2:28 pm | Permalink

    i always use free virus scanners on the internet coz they are quite good too.*”

    • Posted October 7, 2010 at 8:25 am | Permalink

      I have always used free virus scanners as well. I started out with AVG, then switched to Avira, and I am not using Microsoft Security Essentials.

  3. tycoon cashflow
    Posted July 30, 2010 at 12:50 am | Permalink

    Hello thanks for repeating this. A lot of people forget about this. Keep it up !

  4. David
    Posted May 6, 2009 at 12:27 pm | Permalink

    Cool, even though my virus scan can already can have a set time I guess this may still be useful.

    • Posted May 6, 2009 at 3:09 pm | Permalink

      Many virus scanners do. I’m going to write an updated post on the same topic this week.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting