Replace the System Drive With a Larger Hard Drive

Windows No Comments

Normally, to replace a hard drive with a larger hard drive, you would just install the replacement hard drive, copy the data over, and remove the old drive. Very simple. Unfortunately, if the drive you are replacing is the system drive (where the Windows operating system is installed), it gets more complicated.

After living with an 80GB system drive for many years and running out of space repeatedly, I decided to replace it with a 500GB drive. The goal was to do the replacement without re-installing my Windows XP operating system. The secret weapons are BartPE (to generate a bootable CD) and Ghost (to clone the system hard drive).

Create a BartPE bootable Windows XP CD which includes Ghost

  1. Pre-requisites:
    • Symantec/Norton Ghost 8.x (the version I have is 8.2)
    • Windows XP Installation CD
    • CD or DVD Burner drive
  2. Download BartPE builder. I picked the latest “PE Builder v3.1.10a – zip package”.
  3. Unzip the archive (ex: pebuilder3110a.zip) to a directory like “c:\temp\pebuilder”.
  4. Copy the ghost 8.x files to the “c:\temp\pebuilder\plugin\ghost8\files” folder. From my Ghost 8.2 distribution, I copied the following files: ghost32.exe, Ghostexp.exe, Ghostsrv.exe, and GhostCast.chm.
    • BartPE builder expects a file called “Ghostcdr.dll” which did not come with my Ghost 8.2 distribution. I managed to download it from the internet; you can download it from here.
    • Put “Ghostcdr.dll” into the same “c:\temp\pebuilder\plugin\ghost8\files” directory.
  5. Insert the Windows XP installation CD into your CD-ROM drive (say D: drive).
  6. Run “”c:\temp\pebuilder\pebuilder.exe”.
  7. In the first field, “Source: (path to Windows installation files)”, enter the CD-ROM drive letter which contains the Windows XP CD (ex: input “D:\”).
  8. Select “Create ISO image” or “Burn to CD/DVD”. In my case, I selected “Create ISO image” and then later burned the image to a CD using Nero Burning ROM.
    pebuilder.jpg
  9. Click on the “Plugins” button. BartPE builder will verify that your Windows XP CD is accessible and then show a dialog window.
  10. If you want a startup option to boot from the CD or not, then click to select “Boot Fix (Enabling “Press any key to boot from CD”)” and hit the “Enable/Disable” button. The Enabled column value for that entry will change from No to Yes.
  11. Click to select the “Symantec Ghost 8.0″ entry at the bottom and hit the “Enable/Disable” button. The Enabled column value will change from No to Yes. If any required Ghost files are missing, clicking the Enable/Disable button will throw an error message.
    pebuilder_plugins.jpg
  12. Hit Close to close the dialog.
  13. Hit the Build button to create the ISO image or burn to CD/DVD.

Replace the System Hard Drive

  1. Shutdown the computer and install the replacement hard drive. Feel free to re-arrange the drives to connect the replacement hard drive to the first SATA or IDE interface.
    • If you have extra drives, to be on the safe side, you might want to connect only the system drive and the replacement hard drive.
    • Take note of the hard drive sizes so you can distinguish them later on.
  2. Boot the computer with the BartPE bootable CD that was created above.
  3. As BartPE loads, answer No to the “Start Network Support” prompt.
  4. Once BartPE has finished loading, select menu “Go->Programs->Symantic Ghost v8″ and launch “Ghost32″.
  5. In the Ghost program window, select menu “Local->Disk->To Disk”.
  6. Select the Source Disk/Drive by clicking it and hit Ok. You can distinguish the source hard drive from the replacement drive by the smaller size information.
  7. Select the Destination Disk/Drive and hit Ok. The destination drive will be your replacement hard drive which should have a larger size information.
  8. Keep the default size selection and hit Ok.
  9. Double-check the source and destination drive info and click Yes to proceed with the disk cloning. Ghost will start cloning the hard drives. (It took 30 minutes for Ghost to clone my nearly full 80GB drive to the replacement 500GB drive.)
  10. Ghost will complete the process with a “Clone Completed Successfully” message.
  11. Hit Continue, Quit, and select menu Go->Shutdown to shutdown the computer.
  12. Remove the old system drive and make sure that your new replacement system drive is connected to the first SATA or IDE interface (which the BIOS will use as the boot drive). Or simply, connect the replacement hard drive to the interface cable that the old system drive was attached to.
  13. Start the computer and everything should work exactly the same as before, except now you have a lot of free space. Good luck!

Some content above derived from Setup Bart PE and Ghost How to.

Free Microsoft Antivirus and Spyware Protection

Windows No Comments

Microsoft has just released a free virus and spyware protection software for Windows XP, Windows Vista, and Windows 7 called Microsoft Security Essentials (MSE). The nice thing about this news is that MSE is just one program that you can run for total protection from viruses, spyware, and rootkits (a specific form of spyware). MSE is from Microsoft so it should work very well on Windows.

Before installing MSE, make sure to uninstall any existing spyware and virus real-time protection program (these real-time programs run all the time). You will want to go to Add/Remove Programs and uninstall the following programs if you have them:

For those running Windows Vista or Windows 7, you will not be able to uninstall Windows Defender and will have to disable it manually before installing MSE. Supposedly, MSE will automatically disable Windows Defender, but there have been some feedback that this might not occur.

It is not necessary to uninstall non-real-time scanners such as the free MalwareBytes Anti-Malware, which only runs when you launch it and tell it to scan for spyware. If you don’t have MalwareBytes, I recommend installing it and once in a while, updating and running it as a second layer of protection, in case MSE misses some spyware.

Also, I recommend downloading ComboFix and leaving a copy of ComboFix.exe on your hard drive. ComboFix is a spyware and rootkit scanner which I have found to work when everything else failed.

Finally, I’ll end this post with a tip on recovering from a spyware infection. The newer spyware knows about the popular anti-spyware and antivirus programs and will prevented them from being run. For example, if you have an infection and attempt to run Ad-Aware or Spybot, their windows will not appear (their processes are frozen in Task Manager). To get around this, find the executable file (right-click on the program shortcut and select Properties) and rename it. For example, I may rename ComboFix.exe to Dandelion.exe before running it.

Configure Microsoft Outlook 2003 for Gmail IMAP and Yahoo Mail POP3

Windows 1 Comment

In the previous post, I found that restoring Outlook’s PST file did not restore the email support (email account) settings. As a result, I had to re-create my Gmail and Yahoo mail accounts.

IMAP and POP3 are different protocols for retrieving email. POP3 is the older and much simpler protocol; it will only give you access to the Inbox folder. IMAP is younger and more sophisticated; it will give you access to your Inbox and other folders. If your email provider supports IMAP, I would suggest using it over POP3.

Configuring Gmail IMAP

Your Gmail account comes with free POP3 and IMAP access. You just have to enable it.

  1. Log into your Gmail account.
  2. Click on Settings and then “Forwarding and POP/IMAP”.
  3. Click on “Enable IMAP”.
  4. Or if you wish to use POP3, click on “Enable POP for all mail” and select “keep Gmail’s copy in the inbox” in the dropdown for “When messages are accessed with POP”. The reason for the latter option is to prevent POP3 from downloading the mail messages to your Outlook and deleting the mail messages from Yahoo Mail itself.
  5. Click on “Save Changes”.

You can now configure Outlook to access your Gmail account using IMAP.

  1. Run Outlook.
  2. Select menu “Tools–>E-mail Accounts…”.
  3. Select “Add a new e-mail account” and click Next.
  4. Select IMAP and click Next.
  5. Input your name into “Your Name” field and your email address into “E-mail Address” as you would like it to appear in the From field of your emails.
  6. Input “imap.gmail.com” into the “Incoming mail server (IMAP)” field and “smtp.gmail.com” into the “Outgoing mail server (SMTP)” field.
  7. Input your full Gmail username (with the @gmail.com) into the “User Name” field and your Gmail password into the “Password” field.
  8. Do not check the “Log on using Secure Password Authentication (SPA)” box.
  9. Click on the “More Settings…” button.
    • Under General, you can change the name that this email account will show up in Outlook as; I suggest changing this to match your full email address. (You may need to restart Outlook for this change to take effect everywhere.)
    • Under “Outgoing Server”, check the “My outgoing server (SMTP) requires authentication” box and the “Use same settings as my incoming mail server” option.
    • Under Advanced, check the “This server requires an encrypted connection (SSL)” box and input 993 into the “Incoming server (IMAP)” field. (You will want to do it in this order because checking the SSL box will reset the port number.)
    • Next, check the “This server requires an encrypted connection (SSL)” box and input 465 into the “Outgoing server (SMTP)” field. (You will want to do it in this order because checking the SSL box will reset the port number.)
    • Finally, you may wish to increase the “Server Timeouts” from the default 1 minute to 2 minutes.
  10. Click OK, Next, and Finish.
  11. You should see your Gmail account show up as a new root entry in your Outlook’s All Mail Folders.

Because of how Gmail persists emails, deleting Gmail messages using Outlook is a two step process:

  1. Under Outlook, go to the Gmail’s “All Mail” folder.
  2. Locate the message which you wish to delete and drag-n-drop it to Gmail’s Trash folder.
  3. Go to the Trash folder, select the messages you wish to delete, and hit the Delete key on your keyboard. The subject lines for the selected messages will be striken through.
  4. Go to menu “Edit –> Purge Deleted Messages”.
  5. Note: dragging the message from the “Inbox” folder instead of from the “All Mail” folder will just remove the message from the “Inbox” folder and leave it in “All Mail” folder.

Configuring Yahoo Mail POP3

Yahoo Mail only supports POP3 access and only if you have a Yahoo Plus Mail account. If you don’t have a Yahoo Plus Mail account and are technically inclined, you can use the free YPOPs application.

If you have a Yahoo Plus Mail account, you can configure Outlook to access your Yahoo Mail using POP3.

  1. Run Outlook.
  2. Select menu “Tools–>E-mail Accounts…”.
  3. Select “Add a new e-mail account” and click Next.
  4. Select POP3 and click Next.
  5. Input your name into “Your Name” field and your email address into “E-mail Address” as you would like it to appear in the From field of your emails.
  6. Input “plus.pop.mail.yahoo.com” into the “Incoming mail server (IMAP)” field and “plus.smtp.mail.yahoo.com” into the “Outgoing mail server (SMTP)” field.
  7. Input your short Yahoo username (without the @yahoo.com) into the “User Name” field and your Yahoo password into the “Password” field.
  8. Do not check the “Log on using Secure Password Authentication (SPA)” box.
  9. Click on the “More Settings…” button.
    • Under General, you can change the name that this email account will show up in Outlook as; I suggest changing this to match your full email address. (You may need to restart Outlook for this change to take effect everywhere.)
    • Under “Outgoing Server”, check the “My outgoing server (SMTP) requires authentication” box and the “Use same settings as my incoming mail server” option.
    • Under Advanced, check the “This server requires an encrypted connection (SSL)” box and input 995 into the “Incoming server (IMAP)” field. (You will want to do it in this order because checking the SSL box will reset the port number.)
    • Next, check the “This server requires an encrypted connection (SSL)” box and input 465 into the “Outgoing server (SMTP)” field. (You will want to do it in this order because checking the SSL box will reset the port number.)
    • Then, you may wish to increase the “Server Timeouts” from the default 1 minute to 2 minutes.
    • Finally, check the “Leave a copy of the messages on the server” box and the “Remove from server when deleted from ‘Deleted Items’” box. This will keep the mail messages on your Yahoo account until you delete it from Outlook’s “Deleted Items” folder.
  10. Click OK, Next, and Finish.
  11. Unlike with IMAP, your POP3 account will not show up as a new root entry in your Outlook’s All Mail Folders. Instead, POP3 messages are delivered to the store designated as the default delivery location. You can find the default delivery store by doing the following:
    • Select menu “Tools–>E-mail Accounts…”
    • Select “View or change existing e-mail accounts” and click Next
    • The default delivery store is shown in the “Deliver new e-mail to the following location” dropdown.

If you are an AT&T SBC Yahoo subscriber, you can link your yahoo account to your AT&T account and thus, upgrade your yahoo account to a plus account. If you do so, you can use the following alternative POP3 and SMTP server settings, “pop.att.yahoo.com” and “smtp.att.yahoo.com”; though the POP3 and SMTP server settings above should also work.

Deleting your Yahoo mail follows the standard Outlook functionality. You will find your Yahoo mail in your default delivery store. If you delete the mail from your Outlook Inbox folder, it should appear in the Outlook “Deleted Items” folder (even though in Yahoo, it remains in the Inbox folder). If you delete mail from the Outlook “Deleted Items” folder, that mail will finally be removed from your Yahoo account.

Which email account to use when composing a new email?

If you have several POP3 and IMAP accounts, you may want to select one of the accounts as the default to use when composing and sending a new message. Basically, when composing a new email, what is the default From address to use? You can set the default account to use by doing the following:

  1. Go to menu “Tools->E-mail Accounts…”
  2. Select “View or change existing e-mail accounts” and click Next.
  3. Select each account (under “Outlook processes e-mail for these accounts in the following order”) and use the “Move Up” and “Move Down” buttons to re-order it. The first account listed will be the default account used when composing and sending a new email message.
  4. Click Finish.

If you are replying to an existing email message, Outlook will use the account that the email was received on to determine which of your email addresses to use as the From address. For example, if you are replying to an email sent to “you@you.com”, then the reply email will use “you@you.com” as the From address.

The info above was taken from Outlook 2003 – Gmail Help and POP Yahoo! Mail Plus with Microsoft Outlook 2002 (XP) and 2003.

Backing up and Restoring Microsoft Outlook 2003 PST File

Windows No Comments

Recently, I had to move my Microsoft Outlook 2003 PST (Personal Store, I think) file to another machine so I had to learn a bit about how Outlook uses PST files. The PST file may contain your emails, contacts, notes, calendar events, and tasks. The instructions below will help you to backup and restore your PST file on the same computer or on a different computer with Outlook 2003.

Note: Copying the PST file does not preserve the email services (such as POP3, IMAP, etc.) that you have configured. (The email services are also referred to as email support in the Outlook dialogs.)

Backing Up Your PST File

  • Find out where your PST file is located:
    1. Run Outlook
    2. Select menu Tools–>Options…–>Mail Setup–>Data Files…
    3. You should see an entry for your PST file. If you see more than one, that’s okay; just redo the instructions for each PST file.
    4. Double-click on the entry to get a details dialog and look at the Filename field for the location of your PST file. (By default, your PST file should be named “Personal Folders” and its filename/location should be “C:\Documents and Settings\your_username\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst”.)
    5. I strongly recommend renaming your PST file to something more specific than the default “Personal Folders” name. Later on, it will get confusing if you have several PST files with the exact same name.
  • Backup your PST file:
    1. Quit Outlook
    2. Make a copy of the PST file for your backup purpose

Restoring Your PST File

  1. Copy your backup PST file to a machine with Outlook installed. Note the location of the PST file as this will be its permanent location.
  2. Run Outlook. If this is the first time you are running Outlook, just create a default configuration without email support; aka, just select the defaults.
  3. Select menu Tools–>Options…–>Mail Setup–>Data Files…
  4. You will see the default “Personal Folders”.
  5. Click on the Add button, hit Ok, browse to your PST file location, and hit Ok to close the dialog.
  6. You should now see two PST files. (If you have renamed your PST file during the backup, you should only see one “Personal Folders” which is the default PST. Otherwise, you may see two. If you see two, I strongly recommend renaming your PST file at this point.)
  7. Before you can delete the original, default PST file (with comment “Default delivery location”), you must configure your own PST file as the default mail delivery location. If you try to delete the original PST at this point, Outlook will throw an error.
  8. Click Close and Ok to close the Options dialog.
  9. Select menu Tools–>Email Accounts….
  10. Select “View or change existing e-mail accounts” and click Next button.
  11. Select your personal PST file under the “Deliver new e-mail to the following location” dropbox. (Selection is by name so you might get confused if you didn’t rename your PST file.)
  12. Click Finish to close the E-mail Accounts dialog.
  13. Select menu Tools–>Options…–>Mail Setup–>Data Files…
  14. Select the original, default PST file and hit the Remove button.
  15. Once the original PST file is deleted, click Close and Ok to close the Options dialog.
  16. You have successfully restored your Outlook PST file!
  17. Optionally, you can go to the “C:\Documents and Settings\your_username\Local Settings\Application Data\Microsoft\Outlook” directory and delete the default PST file “Outlook.pst” which is no longer used.

Getting Address Book to use your Outlook PST Contacts

Try to open the address book by going to menu “Tools–>Address Book”. If you do not see the contacts from your Outlook PST file, then you will need to configure the Address Book:

  1. Go to menu “Tools–>E-mail Accounts…”.
  2. Select “View or change existing directories or address books” and click Next.
  3. Select and remove any pre-existing “Outlook Address Book” entry that you see.
  4. Click on Add… button, select “Additional Address Books” option, and click on Next.
  5. Select “Outlook Address Book” under “Additional Address Book Types” and click Next, then click Finish.
  6. Restart your Outlook client.
  7. Go to menu “Tools–>Address Book”. If you do not see your Outlook PST file contacts listed, then repeat the actions above. (I had to do it twice to get the Address Book working.)

Note: Strangely, Outlook only allows you to create one “Outlook Address Book”.

Outlook Profiles and Related

Outlook supports having multiple profiles (or configurations) that it can be launched with. By default, it will come with one profile; which is automatically loaded, so you will never see this feature. You can create a second profile and configure Outlook to prompt for the profile when starting:

  1. Right-click on the Outlook Icon on your desktop or in the Start menu and select Properties to display the Mail Setup dialog. (Note: This won’t work on a shortcut to the Outlook program.)
  2. Select Show Profiles
  3. To create a new Profile:
    • Select the Add… button.
    • Input a profile name and hit the Ok button.
    • Click on the Close button and Ok button to not configure email support (POP3, IMAP, etc.); otherwise, configure away.
    • Outlook will create a new profile with a default data file named Outlook.pst (or Outlook1.pst, Outlook2.pst, Outlook3.pst, etc., if there is a pre-existing file in the “C:\Documents and Settings\your_username\Local Settings\Application Data\Microsoft\Outlook” directory of the same name).
  4. Configure Outlook to prompt for a profile on startup by selecting “Prompt for a profile to be used”.
  5. Hit the Ok button to close the Mail Setup dialog.
  6. The next time you start Outlook, it will prompt you for the profile to use.

I found some other Outlook related tidbits of info that you might find useful:

  • At this location “”C:\Documents and Settings\your_username\Application Data\Microsoft\Outlook”:
    • The “outcmd.dat” file stores your toolbar customizations. Quit Outlook, delete this file, and restart Outlook to restore the toolbar to default settings and recreate icons that some add-ins might have installed.
    • I think the Outlook temporary setting files are kept in the . I see some files there that have the same names as the profiles. Strangely, when the profiles are deleted, these files remain, instead of being deleted.
  • At this location “”C:\Documents and Settings\your_username\Local Settings\Application Data\Microsoft\Outlook”:
    • The “extend.dat” file keeps a registry cache of add-in settings. Quit Outlook, delete this file, and restart Outlook to force Outlook to retrieve the settings from the registry again.
    • If you have a profile with “Exchange Server” email support, you will see a file named “outlook.ost”. I think this is the local offline cache of emails and contacts for your Exchange Server account.
    • New Outlook PST files (Outlook.pst, Outlook1.pst, Outlook2.pst) are created here.

Hopefully, you will find some of the info above useful. (Information about “extend.dat” and “outcmd.dat” were derived from Resetting dat-files.)

Backing Up Windows Desktop Locally and Remotely

Windows 4 Comments

To prevent data loss on my Windows desktop, I’ve created automated scripts to backup the data locally and remotely.

For both sections below, we will pretend that I want to backup two directories:

  • C:\Documents and Settings\username\My Documents\Tax Files
  • C:\Documents and Settings\username\My Documents\Photos

Backing Up Windows Desktop Locally

The best way to backup your data locally is to have a second hard drive and copy your data to that second hard drive. This way, if the primary hard drive dies, you still have a copy of your data on the second hard drive.

To do the copy, you could just use the DOS “xcopy” command, but that is very inefficient if you have a large amount of data to copy; each time, it will copy everything again (even if nothing changes). The better way to copy is to apply only the differences between the original data and the copy on the second hard drive. I recommend using Beyond Compare for this purpose (unfortunately, it costs $30).

Warning: I tried using the free RSync program, but it had problems with long path names and will sometimes remove access permissions from directories and files that it copies on Windows. As a result, I wasn’t able to access the directories and files or delete them. With administrative rights, I was able to recursively give myself full rights to the directories and files again. In short, I don’t recommend using RSync for copies where the destination target is Windows. For remote Unix targets, you can recursively adjust the permissions by using ssh to issue a chmod: ssh user@hostname ‘chmod -R 755 /directory’

Here is the Beyond Compare script file, named “daily_backup.bc2″, which I used:

# Turn on logging to a file
log normal "C:\temp\bc_synclog_%date%.txt"

# Load the source and destination folder
load "C:\Documents and Settings\username\My Documents" "D:\Backups\Daily\My Documents"

# Mirror only these directories (the endings slash indicates directory)
filter "Tax Files\;Photos\"

# One-way Mirror from source to destination
sync create-empty mirror:lt->rt

Here is the DOS batch file, named “daily_backup.bat”, which is used to launch Beyond Compare:

"C:\Program Files\Tools\Beyond Compare 2\bc2.exe" @"C:\Scripts\daily_backup.bc2"

move C:\Temp\bc_synclog_*.txt "D:\Backups\Daily\"

Now to schedule Windows to run the DOS batch file once a day:

  1. Go to menu “Start->Control Panel->Scheduled Tasks->Add Scheduled Task”. Click Next.
  2. Click Browse button and select the DOS batch file “daily_backup.bat”.
  3. Select “Daily” and click Next.
  4. Select a start time and click Next.
  5. Input your password. Click Next. Click Finish.

Backing Up Windows Desktop Remotely

The issue with a local backup is that if there is an accident (like a fire), both hard drives may be destroyed. The best backup is to another server which is not physically located in the same location as your desktop.

If you have a remote server which allows FTP access, you can use Beyond Compare to do the copy. Here is the Beyond Compare script to do so:

# FTP prompts if overwriting, set auto confirm yes
option confirm:yes-to-all

# Turn on logging to a file
log normal "C:\temp\bc_synclog_remote_%date%.txt"

# Load the source and destination folder (all on one line)
load "C:\Documents and Settings\username\My Documents" "ftp://username:password@ftp.hostname/backup"

# Mirror only these files and directories
filter "Tax Files\;Photos\"

# Mirror
sync create-empty mirror:lt->rt

If the Beyond Compare FTP hangs, you may need to enable passive mode.

  1. Launch Beyond Compare
  2. Go to menu “Tools->Options->FTP->Firewall / Proxy”
  3. Check the “Passive Mode” box

Beyond Compare FTP does not support delta copies (just copying the differences in the files); so for efficiency, you may wish to use the free RSync if your remote server supports rsync.

Here is the DOS batch script to issue the RSync command:

cd "\Documents and Settings\username\My Documents"

C:\Scripts\RSync\rsync.exe -vrt –delete "Tax Files" username@hostname:~/backup/

C:\Scripts\RSync\rsync.exe -vrt –delete Photos username@hostname:~/backup/

Unless you establish trust with the remote server (ssh.exe and ssh-keygen.exe comes with RSync and the keys are stored into the “%HOME%\.ssh” directory on Windows), RSync will prompt you for the password. This will make automating the remote backup rather difficult since it won’t be able to run unattended. In the case where your remote server doesn’t support establishing trust, you will need to use a scripting tool like Expect, which comes as part ActiveState Tcl.

Warning: Other programs may come with their own ssh.exe and ssh-keygen.exe executables which are not compatible with RSync. To avoid issues, you will want to make sure that the RSync directory is the first one in the “%PATH%” environmental variable.

After installing the ActiveState Tcl above (pick the standard distribution of ActiveTcl which is free), you will need to run the following command to install Expect:

C:\Scripts\Tcl\teacup.exe install Expect

Here is the Tcl/Expect script, named “expect_rsync.tcl”, that will run RSYNC, wait for the password prompt, and input the password for you:

# Load the expect extension
package require Expect

# Enable logging
log_user 1

# Set timeout for password wait to 10 secs
set timeout 10

# Input arguments
array set OPTS {
   host   ""
   user   ""
   passwd ""
   backup ""
}

# Usage info
proc usage {code} {
   global OPTS
   puts [expr {$code ? "stderr" : "stdout"}] \
   "$::argv0 -host hostname -user username -passwd password -backup location ?options?
   -help         (print out this message)"
   exit $code
}

# Parse the arguments
proc parseargs {argc argv} {
   global OPTS
   foreach {key val} $argv {
      switch -exact — $key {
         "-host" { set OPTS(host) $val }
         "-user" { set OPTS(user) $val }
         "-passwd" { set OPTS(passwd) $val }
         "-backup" { set OPTS(backup) $val }
         "-help" { usage 0 }
      }
   }
}

parseargs $argc $argv

# Make sure we are not mssing any input arguments
if {$OPTS(host) == "" || $OPTS(user) == "" || $OPTS(passwd) == "" || $OPTS(backup) == ""} {
   usage 1
}

# Spawn an rsync process
spawn rsync -vrt –delete $OPTS(backup) $OPTS(user)@$OPTS(host):~/backup/
match_max 10000

set id $spawn_id

# Look for passwod prompt
expect -i $id timeout {
   puts "timed out"
   exit -1
} eof {
   puts "spawn failed with eof"
   exit -1
} "*?assword:*" {
   send -i $id — "$OPTS(passwd)\r"
}

# send blank line make sure we continue session
send -i $id — "\r"

# Close session and wait for spawn return
wait -i $id

Here is the DOS batch script to issue the Tcl RSync command:

cd "\Documents and Settings\username\My Documents"

C:\Scripts\Tcl\tclsh85.exe C:\Scripts\RSync\expect_rsync.tcl -host hostname -user username -passwd password -backup “Tax Files”

C:\Scripts\Tcl\tclsh85.exe C:\Scripts\RSync\expect_rsync.tcl -host hostname -user username -passwd password -backup Photos

Encrypting Your Remote Backup Files

If your remote server is not 100% secure (it may be your web hosting service), you may wish to encrypt your backups before copying them to the remote server. I use Winzip for this purpose. Winzip 10 or later comes with a free command line interface which we can script.

Here is the DOS batch script I use to zip, encrypt, and copy to the remote server:

"C:\Program Files\Tools\WinZip\wzzip.exe" -spassword -ez -p -r -u -ycAES256 -ybc -yu "C:\Documents and Settings\personal\My Documents\zip_archives\tax_files.zip" "C:\Documents and Settings\personal\My Documents\Tax Files\*"

"C:\Program Files\Tools\WinZip\wzzip.exe" -spassword -ez -p -r -u -ycAES256 -ybc -yu "C:\Documents and Settings\personal\My Documents\zip_archives\photos.zip" "C:\Documents and Settings\personal\My Documents\Photos\*"

C:\Scripts\RSync\rsync.exe -vrt –delete zip_archives username@hostname:~/backup/

The “-u” flag given to Winzip tells Winzip to update the archive file. This will add new files to or update existing files in the zip archive which have changed. Using this flag will drastically reduce subsequent executions of Winzip. Note that Winzip will not remove files from the archive, so if you wish to have a 100% accurate archive file, just delete the archive file and a subsequent run of Winzip will regenerate it.

RSync over SSH

In the worse case, your remote server may support SSH but not RSync. You can still run RSync over the SSH connection. Here is the updated RSync command to use:

C:\Scripts\RSync\rsync.exe -vrt –delete -e "ssh -p port -l username -v" zip_archives hostname:~/backup/

You may omit “-p port” if your remote server uses the default SSH port of 22.

Unfortunately, if you cannot establish trust with the remote server and need to input the password, automation using the Tcl/Expect script is not possible. There is an issue in the current version of ActiveState Expect that prevents it from working with RSync over SSH.

DOS Batch Tools

I had to create two command line tools to enhance the DOS batch functionality. The first tool is called WinClose.exe and it is used to close running programs. I used it to close Microsoft Outlook to unlock the storage file so that I could copy it. The second tool is called Wait.exe and it is used to pause the batch execution to allow Microsoft Outlook enough time to completely close (5 seconds) before the copy occurs. You can find these two tools in my Open Source page.

Optimize Your Laptop Battery Usage

Windows No Comments

Adjust the power settings on your laptop to conserve energy:

  1. Right click on the empty desktop background and select Properties.
  2. Select the Screen Saver tab and hit the Power button.
  3. Under Power Schemes, you should see two columns, one for Battery and one for Plugged in.
  4. You can change Turn off monitor and Turn off hard disks to be both the same as System Standby. (You can set them to Never also; not recommended for Battery mode.)
  5. Hit Apply or OK to save your changes.

Quick Windows Startup with Hibernate Mode

Windows No Comments

There is a way for your laptop to quickly start up. Just put it into hibernate mode instead of shutting it down.

  1. When you go to menu Start->Turn Off Computer, you will get a popup with Standby, Turnoff, and Restart options.
  2. Hold down the Shift key and the popup will change to Hibernate, Turnoff, and Restart options.
  3. Select the Hibernate option.

Hibernate will write the computer memory to hard drive so that when you next turn on the computer, it will put itself back to the current state very quickly by restoring the memory.

Note that eventually the system may not allow you to Hibernate (you will get an error)… at this point, you have to shutdown or restart the computer to clean up the system.

Change Header Level Displayed in Table of Contents (Microsoft Word)

Windows No Comments

If you use Microsoft Word to generate your table of contents, you may be annoyed to find that the table of contents will not have subsections that are more than three levels deep. To fix this, do the following:

  1. Open your document in Word.
  2. Go to the Insert menu, Reference, and then click Index and Tables.
  3. Select the Table of Contents tab.
  4. To the right of the Formats list near the bottom, there is a Show Levels edit box.
  5. Set the level to what you want. By default, it is usually 3.
  6. Click OK. You may need to regenerate the table of contents.

How to Protect Your Computer

Windows No Comments

Before you connect to the Internet, you should have anti-virus and anti-spyware protection enabled. You don’t need to pay for these software because they are free.

If you are on a slower computer, just installing the anti-virus is sufficient. During installation of AVG Anti-Virus, you should disable the daily scans.

If you have been infected by spyware (ex: popups appear all the time), then you may wish to run a full spyware scan of your computer with Windows Defender. If this action doesn’t solve your problem, then install and run scans with these anti-spyware programs:

If you use Norton AntiVirus or McAfee VirusScan and they have expired, you can still update them manually:

Getting Out of Safe Mode

Windows No Comments

In safe mode, you will see the words safe in all four corners of the screen. If this is the case, then shutdown and restart your computer.

If it still comes back up in safe mode after the reboot, then there is a problem with one of your devices. Did you just recently install something? Try uninstalling and/or unplugging the device.

If you don’t see safe in the corners, then you are running in normal mode and you just need to change your resolution.

To do so:

  1. Right-click on the desktop (the default area of the screen where there is no window). Or go to start->Settings->Control Panel->Display to get the same thing.
  2. You will see the display properties window, click on the Settings tab.
  3. On the bottom right, you will see Screen area. Select 800 by 600 pixels. On the left, you will see Colors. Select High Color (16 bit).
  4. Hit the Apply. Then OK.
  5. Restart your computer.

« Previous Entries