How to Automate Your Computer Maintenance

As you use your computer it can become slower as time goes on. As you create and delete files, your hard drive can become fragmented, and take up valuable space. Uninstalled applications may also leave behind shortcuts or files that are no longer needed which can also use up disk space. If you use the Internet a lot, you may have had the unpleasant experience of battling with viruses, trojans or spyware. These are several reasons why it is important to maintain your computer.

While it may sound complex, performing regular computer maintainence doesn’t have to be complicated. In fact, you can automate the whole process so your computer can sort of “self-clean”. All you need to do is install the right tools, and create a schedule that works for you. In this post I’ll explain what I have done to maintain my old Pentium IV 1.7GHz machine so it can run Windows XP without any issues.

What Needs to be Done?

There are several tasks that need to be performed to maintain your computer. These tasks should be run on a regular basis, so this is where the automation portion comes into play.

As mentioned, it is important to first install some necessary tools to help you automate the maintenance of your computer. Below is a list of the functions that we will need to perform, along with some tools to perform the function.

  • Virus Scanning – AVG and AntiVir are two good choices that are free. I have started to use AntiVir and currently run it on my computers.
  • Spyware Removal – Spybot Search & Destroy is a free spyware tool that can easily be executed. There are many others, that may be better, that you can also use.
  • Disk Cleanup – CCCleaner is probably one of the most popular that can clean a lot of files from you machine. I am currently using this tool.
  • Disk Defragmenting – I currently use JKDefrag that is small, easy to use, and free. I find it works better than the Windows defrag utility as you only need to run it once to defrag all your files.

The tools listed above are the ones that I currently use, or have used in the past. You can choose the tools that work best for you. There is no perfect virus scanner or spyware removal tool, so you may have a better option. For spyware, you may also want to run more than one tool just to be safe. In my example below, I will use the tools mentioned above.

Automating the Maintenance

The important aspect of automating the maintenance of your computer is to pick a time when it can be done. You should pick a time when you aren’t usually using your computer so it won’t interfere with what you are doing. A good time may be early in the morning. For me I decided that early Saturday mornings work best for me, so that is when I scheduled the maintenance.

Now that I have picked my time, I needed to think about how all the tools will execute. Most virus scanners have their own built in scheduler that you can use. I wanted to use this scheduler, but also wanted to ensure that only one tool was running at one time. After doing some thinking, here is what I came up with:

  1. At 12:00am, the virus scanner will run. This schedule is setup within the virus scanner. I estimate a time of about 2 hours to execute.
  2. At 2:00am (two hours after the virus scanner runs), the spyware tool executes.
  3. Immediately after the spyware tool finishes, the disk cleanup begins.
  4. Once the disk cleanup finishes, the defrag program runs to defrag the hard drive.
  5. After the hard drive is defragged, the computer is shutdown since the maintenance is complete.

Now setting up the virus scanner to run is easy (hopefully). Read the documentation for your virus scanner if you don’t know how to schedule a scan. Running the remaining tools is just as easy, and can be done with a batch file. My batch file looks like:

@echo off
start /w "Cleaning" "C:\Program Files\CCleaner\CCleaner.exe" /AUTO
start /w "Spybot" "C:\Program Files\Spybot – Search & Destroy\SpybotSD.exe" /autoimmunize /autocheck /autofix /autoclose
start /w "Defrag" "C:\Program Files\JkDefrag\jkdefrag.exe" -a 3 -d 2 c: -q
shutdown -s -f

As you can see there are a few things to note here. Each command begins with start /w which tells the computer to wait for the command to finish executing. Once the command has completed, the next command is then executed. This is how I control the start of each tool

The final command shuts down the computer. I discuss the shutdown command in the post titled Restart or Shutdown Windows from a Batch File.

Once you have the batch file, you can then schedule it within Windows Task Scheduler to run at a specific time. In my case it would be 2:00am on Saturday. I would then leave my computer on overnight on Friday, with the monitor off, so the tasks can run. By the time I get up on Saturday, the tasks have run and my computer has been turned off.

It is important to note that you should ensure your spyware and antivirus tools are up-to-date.

Follow Me