Robocopy backup script with Bitlocker support

Due to security and comfort considerations I enhanced my previous backup script to include the Bitlocker unlock process.

  1. the script tries to unlock the USB Key if it’s still locked
  2. after the notification if the stick got unlocked or the password was wrong there is a countdown of 5 seconds, press Y to reenter the password. (there’s room for further improvement, more on that later)
  3. when the 5 seconds pass (or the N-Key got pressed), the backup process begins
  4. after the backup process I can chose between either leaving the stick mounted or not
  5. after 15 seconds the script choose the default option which is to leave the stick mounted
  6. after another 30 seconds, or after any key press, the script closes the command line
@ECHO OFF
:UNLOCKERROR
CLS
ECHO ### TRYING TO UNLOCK BITLOCKED USB KEY
ECHO ###
ECHO ###
manage-bde E: -unlock -pw
CHOICE /T 5 /D N /M "### REENTER PASSWORD?"
IF Errorlevel 2 Goto GOON
Goto UNLOCKERROR
:GOON
CLS
ECHO ### STARTING BACKUP
ECHO ###
ECHO ###
robocopy C:\Users\username\Documents\_MDAW\_Thesis\ E:\ /E /MT:8 /tee /log+:E:\_backup_log.txt
robocopy C:\Users\username\Desktop E:\ workingHours.xlsx /log+:E:\_backup_log.txt
robocopy C:\Users\username\Desktop E:\ fuelReport.xlsx /log+:E:\_backup_log.txt
robocopy C:\Users\username\Documents\Scripts E:\ backupThesis.bat /log+:E:\_backup_log.txt
ECHO ### BACKUP FINISHED
ECHO ###
ECHO ###
ECHO ### TO UNMOUNT USB KEY PRESS Y.
ECHO ### TO LEAVE IT MOUNTED PRESS N OR WAIT 15 SECONDS.
CHOICE /T 15 /D N /M "###"
IF Errorlevel 2 Goto NO
IF Errorlevel 1 Goto YES
Goto End

	:YES
	manage-bde E: -lock
	GOTO END

	:NO
	ECHO USB KEY NOT UNMOUNTED

:END
TIMEOUT /T 30

Next Steps:

  • find a way to trigger the first if clause dependent on whether the password was right or not
  • implement selection for drive letter with a default option

Robocopy

Today I had to find a way to backup my Thesis data fast and efficnetly to an ecnrypted USB key. After a brief google search I stumpled over a tool which was previously recommend to me many times. After checking a few parameters i deployed a rather simple but efficent backup script which gets executed on every shutdown or when the computer is put into hibernation mode.

Robocopy Backup Plan

So with the coporate backup solution in the background and my quick and dirty USB Key mirroring I’m aligned with company rules and I’m feeling pretty safe right now.

nClone for Synology Disk Stations

nClone in action

The guys from nClone.com release a beta package for Synology Diskstations running DSM 4.0. This package turns your sweet little DS into a, Clonezilla based, network cloning appliance. The best thing? It’s currently free for private users and if your DS is compatible it just works beautifully.

So don’t hesitate, swing over to www.nclone.com and get your copy!