GEGeek 
   I don't reinvent the wheel, I just link to it.                                                                          Control-F To Search This Page!
Cheat Sheets Search Engines Diagnostics Misc Tech

GEGeek's Articles

Home

Windows

Software

How To Guides

Tutorials

Hardware

Security

Linux

GEGeek Articles

 

 

 

 

 

 

 

 

 

 

 

 

   
 

Have Your PC Automatically Clean Up After Itself

        

   Unfortunately Microsoft Windows is an Operating System that routinely needs some maintenance, depending on how much you use the system. After years of manually cleaning and optimizing my system I finally automated the entire process and I did it all for practically nothing. Some commercial programs actually performed certain tasks better than the free versions did, so I purchased them, but I’ll leave that decision up to you. So I am going to outline the procedure here for you to consider. It's a little extra work up front, but after that you'll never need to touch your pc again. Well, maybe you will. It is Windows. ;)

Also please be advised that this is only an outline of what I do. I try to be thorough, but I have to assume a certain level of skill on the reader's part. You're suppose to be a Techie, remember. ;)

 

So here’s what my PC does EVERY NIGHT.

 

1> 1:00am      Run the System Cleaner

2> 1:15am      Run the Registry Cleaner

3> 1:30am      Run the Virus scan

4> 2:30am      Run the Spyware scan (Adaware and Spybot)

5> 3:30am      Defrag My Main Drive

6> 4:00am      Sync up Data folders to Ext. USB Drive

7> 4:15am      Reboot

8> 4:25am      Run My Incremental Backup Every Night. Sunday Full Backup

9> 5:30am      Reboot

                       

 Keep in my mind that by cleaning and defragging every night there shouldn’t be that much work for the system

to do, thus it completes its tasks faster and doesn’t work as hard. This also keeps the system performing at its

peak all the time.


 

1> 1:00am       Run the Cleaner

I try to use as many free programs as possible, so long as they do the job well. I chose CCleaner for our cleaner.

Big issue I have with cleaners is that they sometimes delete key files that disrupt normal operations. I can’t have

that. CCleaner has proven to me that it is safe. Another prerequisite for me is that it have an “auto-run” feature,

which CCleaner does. Another program I have used is A1Cleaner.

 

The "CCleaner /AUTO" parameter can be used in and with:

Batch files (.bat).

Shortcuts/links such as; making one on the desktop named CCleaner (Auto).

Via the Windows Task Scheduler.

From within CCleaner itself which will allow it to run at every system startup and/or logon.

 

Here is a sample command line to use in the Task Scheduler: 

Ex:  "C:\Program Files\CCleaner\ccleaner.exe" /AUTO

 

Then we schedule this task to run at 1:00am in Windows Task Scheduler

( Control Panel – Scheduled Task – Add Scheduled Task ). Use the above guidelines for the shortcut.

 

Only word of caution here is that you supply a username and password for the account to run under. If you do

not have a user with a password then create one. Scheduled tasks seem to work better on accounts with passwords.


 

2> 1:15am       Run the Registry Cleaner

Here’s our first real problem. After years of trial and loads of errors, I have yet to find a free quality registry cleaner. If you know of one please let me know. What you have to watch out for are those unscrupulous individuals that create free registry cleaners and drop their malicious code into the program. This is a big problem out there, so be very careful with the freebies. Especially registry cleaners. My choice is RegVac. Has both a novice and expert mode, as well as the “auto-run” feature. To get RegVac to run in the task scheduler is simple. Point your link to the program followed by the parameter  /schedule.

That’s it. ex:    "C:\Program Files\RegVac Registry Cleaner\regvac.exe" /schedule            Then we schedule this task to run at 1:15am in Windows Task Scheduler

 


 

3> 1:30am       Run the Virus scan

Total maintenance requires that we keep our systems clean of any malware. Therefore I run a complete full scan of my system every night. Depending on your system, should take between 30 and 60 minutes. Usually

you schedule this right in the virus scanner program itself. So schedule this task to run at 1:30am in the Virus Scanner’s Task Scheduler

 


 

4> 2:30am       Run the Spyware scan (Adaware and Spybot)

You need to understand that there isn’t one program out there that can catch everything. Some are better than others at finding certain problems and others fall short. But I have found that the combination of Adaware and

Spybot catches a vast majority of the malware out there today. Definitely the proven veterans in the field.  You can download these at Ad-Aware Free  and Spybot

 

Now here’s where it might look like it gets complicated but it’s not really. Just follow along. We need to setup a command line for both programs to run automatically from the Windows task scheduler. So all you have to do is launch the program and search it’s help file for the command line parameters.

 

Here is a list of command line parameters that the Spybot-S&D main executable (SpybotSD.exe) supports:

 

  • /taskbarhide
    Runs Spybot-S&D completely hidden (no window, no taskbar icon), so make absolutely sure you use it only in

  • combination with /autoclose (otherwise it would remain in memory sitting idle). Useful only in combination with

  •  /autocheck, /autoupdate

  • or

  •  /autoimmunize, as it cannot be controlled when completely invisible.

  • /minimized
    Starts the window minimized.

  • /uninstall
    Uninstalls Spybot-S&D. This command line parameter is very outdated - unins000.exe should be used instead!

  • /blinduser
    Starts with support for blind users (special menus).

  • /autoupdate
    Does an update after starting the program.

  • /autocheck
    Starts scanning immediately.

  • /autofix
    Fixes problems after scan.

  • /autoclose
    Closes program after it has scanned or updated.

  • /autoimmunize
    Runs the immunization at program start.

  • /onlyspyware
    Fixes only spyware (red) entries with /autofix, leaving all usage tracks as they are.

  • /easymode
    Starts with easier interface for beginners.

  • /createenglish
    Updates the English.sbl language file with the newest texts; useful only for translators.

 

Here’s a copy of my command line right from my PC.

“C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe” /autoupdate /autocheck /autofix /autoclose

 

If you installed Spybot per its default then you could probably just copy and paste this line into the Windows task scheduler. Check it to be sure. Schedule this task to run at 2:30am

 

Now we have to the same for Adaware. If you look at the help file in Adaware and search on word "command" you’ll find tons of parameters to choose from.

To save some space I won't list them all here. I'm sure you get the idea by now.

 

Here’s my shortcut command line for Adaware:

“C:\Program Files\Ad-Aware2007.exe” /Full /Silent /Cookies /Clean /Update

 

Schedule this task to run at 3:00am via the Windows Task Scheduler

 

 


 

5> 3:30am       Defrag My Main Drive C:

Microsoft has made this one very easy for me. They have a detailed description of the procedure that I will copy here:

This procedure is for XP.

 

1.  Open Control Panel
2.  Double-click
Scheduled Tasks
3.  Double-click
Add Scheduled Task
4.  On the Scheduled Task Wizard dialog, click
Next
5.  Click
Browse
6.  In the Select Program to Schedule dialog, navigate to the windows\system32 folder
7.  Select
defrag.exe
8.  Click
Open
9.  In the Scheduled Task Wizard dialog, type a name for the scheduled task (Disk Defragmenter, for instance)
10. Under Perform this task, select how often you wish Disk Defragmenter to run
11. Click
Next
12. Set the time at which you wish the Disk Defragmenter scheduled task to run.  This should be a time when your

      computer is on,

      but not in heavy use.
13. Select the frequency at which you want the Disk Defragmenter scheduled task to run (Every Day, Weekdays, or

     Every <N> days, where <N> is the number of days between scheduled runs)
14. Click
Next
15. Enter a user name under which the Disk Defragmenter scheduled task will run. 
Note: This user must be an

     administrator on the local machine.
16. Enter the password for the user you entered in the previous step
17. Confirm the password for the user
18. Click
Next

19. Check
Open advanced properties for this task when I click Finish
20. Click
Finish
21. In the
Run text box, you should see the full path and command for defrag.exe.  By default, this path is

      C:\WINDOWS\SYSTEM32\defrag.exe
22. Append the drive letter for the drive you wish to defragment to the command in the Run text box.  In a

     default installation,

     your Run command will look like this:       C:\WINDOWS\SYSTEM32\defrag.exe C:
23. Click
OK
24. In the Set Account Information dialog, enter and confirm the password for the user listed in
Run as

25. Click
OK

 

Note: For those of you with Windows 2000, or just don’t seem to be able to get this to work, I found a site that created scripts you can schedule to do the defrag for you. You just need to

schedule the script to run. The scripts are located here:     http://www.compu-docs.com/W2KDfrag.htm

 

They also have an AutoDefrag program there which I have used in the past. Very nice. Works fine.

 

Once you’ve tested the defrag program, the scripts or the defrag.exe scheduled task, set it to run at 3:30am.

The defrag program should only run for few minutes given the fact that it will be running every night. There shouldn’t be that much to defrag after one day.

 

Note: Here's an option for you.

You can create your own batch file program that performs a disk check as well as a defrag. I use it at work.

1>Create a notepad file with the following contents and name it "Dskchk.cmd". Just copy and paste.

   

REM chkdsk and defrag automation
for /F "eol= tokens=1 delims=( " %%i in (DrvLtr.txt) do set DrvLtr=%%i& call :dsKchk

:dsKchk
If %DrvLtr% == end goto :eof
chkdsk %DrvLtr%
If not errorlevel 3 goto :defrag
If not exist %DrvLtr%\winnt If not exist %DrvLtr%\windows If not exist %DrvLtr%\pagefile.sys goto :dskchkon

:dskchkoff
cd\
%DrvLtr%
echo Y chkdsk /F /R
goto :defrag

:dskchkon
chkdsk %DrvLtr% /F /R

:defrag
cd\
%DrvLtr%
defrag %DrvLtr% -b -f -v
defrag %DrvLtr%
:EOF

 

2> Next create another notepad file named "DrvLtr.txt" and list all the drives you want tested,

one per line, with a colon.

 

Example: The file's contents would contain the following two lines only. One drive per line. Then an "end" statement. That's it.

c:

d:

end

 

 

Store both files in the same directory some where of your choosing.

And schedule the batch file "DskChk.cmd" to run whenever. Works really well.

Just double the file to test it out. Should perform a disk check live without a need to reboot first and then a defrag.

 

More AutoDefrag scripts here

 


 

6> 4:00am       Sync up Data folders to Ext. USB Drive

         This one will be tough simply because of all the options we have here. I am going to assume that you just want to backup the “My Documents” folder and all its sub-directories and that you want to use whatever free program is available with Windows.

         First off, I really recommend you purchase an external drive to store house all your important data. The prices have fallen so much just over the past two years that it really makes sense for everyone to have one. Secondly, I already wrote an article about using the internal DOS command called XCOPY that is just right for this article. You can read it here if you like.  XCOPY The forgotten DOS Command In that article I already gave a valid example of how to use the command.

 

   The format of the command will be:     XCOPY [source] [destination] [/switches]

 

Here’s a sample command:

  xcopy     C:\Source_Folder     E:\Destination_Folder    /D /E /C /R /H /I /K /Y

 

 

Here’s what those switches do

/D Switch = Copies files changed on or after a specified date. If no date is given, copies only those files whose source time

is newer than the destination time.

/E Switch = Copies directories and sub-directories., including empty ones.

/C Switch = Continues copying even if errors occurs.

/R Switch = Over writes read only files.

/H Switch = Copies system and hidden files as well.

/I   Switch = If destination does not exist and copying more than one file, assume that destination must be a directory.

/K Switch = Copies attributes. Normal xcopy will reset read-only attributes.

/Y Switch = Suppress prompting to confirm you want to overwrite destination files.

 

Note:  This command will copy all the files, including those in sub-folders, that are newer in the source folder when compared to the destination folder. Try it with some non-critical folders first to verify that you have the process down.

 

The best way to do this is to copy the above command line to a notepad file and then rename it to "backup.bat" Save it to a directory of your choosing and then have the Windows task scheduler run that batch file when needed.

 


 

7> 4:15am       Reboot

Here’s where I like to use a paid program because I can do so much more with these programs then at the command prompt alone. I have used two programs in the past:   ShutDownOne Pro  and   System Scheduler Pro    Take a look at both and you decide.  Here's a link to the DOS shutdown command and its parameters. Just create a batch file with the commands and schedule it to run at the desired time.

Only problem is you can't schedule an auto login, which is what I have my PC do for me every morning.

 


 

8> 4:25am       Run My Incremental Backup Every Day except Sunday Morning

                        Sunday Mornings while I am in church I do a Full DISASTER RECOVERY backup

 

Again here is where I use a paid program,  Acronis True Image. Very reliable, fast and flexible program. Here’s where your external USB drive would come into play. I can't stress enough how important this step is. Especially the Disaster Recovery Backup on Sundays. It has saved my tail on many occasions. "True Image" makes it so easy that I just don't understand why people run their systems without a backup. If you're running Windows you need a Full DISASTER RECOVERY backup.

 


 

9> 5:30am    Reboot with one of the programs you decided on and you are done.

 

 

So that's the outline of my daily scheduled tasks. So if you are truly a techie you no doubt have run these programs on your own at one time or another or even scheduled a few of them.  But this outline covers all the tasks that are needed to automatically maintain Windows. I find that these articles are very useful to refer people to instead of me having to try and explain it to someone in the field. I always assume a certain level of expertise in these articles, otherwise you shouldn't even be in your system that deep anyway. Give it a try and I'm sure you'll be excited at the prospect of having your PC maintain itself. Inevitably you'll start experimenting with other ideas and things you can do at night. For example, I experimented a bit with macros so that after the system rebooted in the morning it would then automatically launch my email program and download all my emails. I also launched my calendar and highlighted all of the day's activities. Automation can be applied to almost any program you run. I'm sure you run programs that require some type of repetitive tasks on your part that could be automated. This could open up a whole new world

for you.

  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   
   

hit counter