ZonaNet Blog: Backing Up Business Data
ZonaNet Blog Home Page



Are You ZonaNet Blog Visitor?


eXTReMe Tracker

Backing Up Business Data
Thursday, June 28, 2007
More accurately, "small" business data. Below you will find what I believe is an ideal solution for small business owners who need to secure their valuable data off-site.

1. Get a Good Flash Key

Preferably a key manufactured by PQI or Corsair. You will finda variety at Newegg.com under Computer Hardware » Flash Memory and Readers » USB Flash Drives. The 2GB PQI Model
BB53-2031R0111 is a good choice for small business needs at only $26 delivered to your door, but look for the 4GB model if available. This series caps securely, includes a handy lanyard,
and looks as good as your business. You will pay a premium but it may be worth it if you feel the need for extreme speed: Corsair's Flash Voyager "GT" key series provides 34MB/s read and 27MB/s write times. Very impressive indeed.

2. Use Robocopy as Your Workhorse

You will find that most of your data does not change and therefore does not need to be backed up repeatedly. Only newly created or altered files need to be copied after the initial backup job has been performed. Enter Robocopy, a robust command line utility that compares files during copy operations. By default, Robocopy will only perform a copy operation if the source and destination files have different time stamps or different sizes. That means no redundancy, no wasted time. Beautiful.

3. Create a Custom Autorun.inf File

Autorun functionality is disabled by default for USB devices. Therefore, you cannot fire up a routine—in our case, the backup operation—just by plugging in the key. You can, however, add a custom entry to the autoplay dialog box by including the parameter "action" in an autorun.inf file. Adding a custom icon is a nice touch.


action=Click “OK” to run the Backup Operation!

4. Write the Backup Script

  • Now this is where things get interesting. Well, interesting if you appreciate a technical challenge. Got Geek? Then ask yourself, how can we reliably copy mission-critical data from one or more sources to the flash key and verify same? Some issues to consider:

    The flash key drive letter assignment is subject to change. Today it is the F: drive but tomorrow it might be the G: drive depending on your configuration.

    Pretend we are in a simple network environment. It would be nice to back up valued data from multiple machines in one simple operation.

  • If a document is open and unnoticed when the backup job commences, will the entire backup operation fail?

  • It's best to shut down the PC following the backup operation and then remove the key. Just pulling the key is probably fine for Joe-Home-User on a Windows XP box but is foolish when your business data is on the line. We also know that the "Safely Remove Hardware" feature is not always responsive.

Taking into account these and other considerations, here's the script:


If _Singleton('test\test',1) =
0 Then Exit;prevent multiple scripts from running

#include ‹TOOLS\AU3includes\Constants.au3›

#include ‹TOOLS\AU3includes\Misc.au3›

TraySetIcon( @ScriptDir
& '\TOOLS\icon.ico')

TraySetToolTip('Backup operation is running . . . ')

$usb = DriveGetDrive("REMOVABLE")

If Not @error Then

;MsgBox(4096, "",
"Found " & $usb[0] & "
drives") ;‹-- uncomment to verify

For $i = 1 To $usb[0]

If DriveGetLabel($usb[$i]) = "PQI_4GB"

$TargetDrive1 = $usb[$i];‹==
set flash key drive letter assignment






DirCreate($TargetDrive1 &

DirCreate($TargetDrive1 &

If MsgBox(4, 'Backup Operation', 'Has the Client PC
been turned off?') = 7 Then

MsgBox(16, 'Backup
Operation', 'Please turn off the Client PC before performing _

the Backup Operation!', 5)



Backup();perform the backup operation

MsgBox(0, 'Backup Operation',
'The Backup Operation completed successfully!')

If MsgBox(4, 'Backup Operation', 'Do you want to shut down the Server
and _

remove the Flash Key?') = 6 Then







Func Backup()

FileDelete( $TargetDrive1
& '\*.log');delete old log files

TrayTip('Backup Operation',
'Backup Operation in progress . . . ', 0, 1)

TraySetState (4)

Operation in progress . . . ')

Dim $prog = @ScriptDir & '\TOOLS\robocopy.exe'

Dim $source1 = 'C:\Directory One';specify
directory here

Dim $source2 = 'D:\Directory Two';specify
directory here

Dim $dest1 = ($TargetDrive1 & $MyDir)

Dim $dest2 = ($TargetDrive1 & $MyDocs)

Dim $what = '/V /E /COPYALL /B'

Dim $options = '/R:3 /W:3'

Dim $log = ('/LOG+:' & $TargetDrive1 & '_Logfile.log')

& ' "' & $source1 & '" "' & $dest1 & '"
' & $what & ' ' & $options & ' ' & $log, '', @SW_HIDE)

& ' "' & $source2 & '" "' & $dest2 & '"
' & $what & ' ' & $options & ' ' & $log, '', @SW_HIDE)


TraySetState (8)

TraySetToolTip('Backup job is
running . . . ')


5. Put It Together

Go ahead and format the key, giving it a name. In the example above, I have formatted my key as "PQI_4GB." You will need to place the autorun.inf file on the key together with a directory called "backup," which contains additional directories and files including:

  1. A directory called "backupjob," which houses the above script in compiled form.

  2. A directory called "TOOLS" located inside "backupjob." It holds the icon.ico file and robocopy.exe. Different Robocopy versions exist; I use the 85KB version pulled from Vista's System32 directory. The 78KB version included with the Windows Server 2003 Resource Kit also works well.

  3. A directory called "AU3includes" located inside "TOOLS." It contains the constants.au3 and misc.au3 include files copied from the AutoIt program files directory.

So if you can put six files on a flash key, you have yourself a kickin' backup solution. Hey, it's not supposed to be easy. If it was, everyone would do it.

6. What it Does

More soon . . .ZonaNet

posted by ZonaNet @ 6:53 AM  
Post a Comment
About Me

Name: Yazin Alhamdi
Country: LIBYA
About Me: Angel!
Email: yazin.alhamdi@gmail.com
My Guest Book
Previous Post
Powered by


© ZonaNet Blog Template by ZonaNet