I wrote a batch file that starts at 4am, which is guaranteed to be after all my backups are finished.
It RARs all the folders inside WindowsImageBackup
(or whatever that folder is called), gives them a date stamped filename, and copies them to a secondary server, and from there they are replicated off-site.
This way I've got months (years?) worth of historical backups, at least one of which will be good.
As for not overwriting backups, the only way WSB allows you to do this is to use a locally mounted block-storage device (such as a hard drive, USB drive or an iSCSI disk).
As for validating the image, I have another script that runs Sunday evening at the remote site that grabs a random backup image from the last 7 days, un-RAR's it, creates a VM and boots it. Because I haven't quite finished the scripting part, every Monday morning (when I remember) I spend 5 minutes just initiating the restore procedure and then check it later to see if it succeeded.
All in all it sounds a bit ghetto, but this particular client had a very limited budget (read: none), so I was restricted to using free tools. And so far it's worked really well.
@echo off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /f %%I IN (
'wmic volume get driveletter'
) DO (
ECHO %%I | FIND ":"
IF ERRORLEVEL 1 (
echo Failed: %%I
) ELSE (
ECHO %%I | FIND "D:"
IF ERRORLEVEL 1 (
IF NOT [!_TEMPVAR!]==[] SET _TEMPVAR=!_TEMPVAR!,
SET _TEMPVAR=!_TEMPVAR!%%I
) ELSE (
echo Skipping CD-ROM
)
)
)
wbadmin enable backup -addtarget:\\enetsbackup1\Backups -schedule:23:00 -systemState -allCritical -vssFull -user:backupservice@enets.local -password:[password] -quiet -include:!_TEMPVAR!
To RAR files into date-stamped and passworded files (run on the server that hosts all the backup file shares)
@ECHO OFF
SET _WINRAR=C:\Program Files\WinRAR\Rar.exe
SET _BACKUPPATH=C:\QNAPBackups\WindowsImageBackup\
REM RAR All backups into date-named files
forfiles -p %_BACKUPPATH% -m *.rar -d -3 -c "cmd /c del @path"
FOR /D %%I IN (%_BACKUPPATH%*) DO (
"%_WINRAR%" a -ag-YYYYMMDD -ep1 -hp[password] -m2 -df "%%I.rar" "%%I"
)
Move files into off-site sync dir, and clean up the sync dir
prepareoffsite.bat
SET _BACKUPPATH=C:\QNAPBackups\WindowsImageBackup\
forfiles -p %_BACKUPPATH% -m *.rar -c "cmd /c C:\Batches\CopyOffsite.bat @path"
copyoffsite.bat
A little bit of an explanation:The batch takes the backup name and it goes through a list of txt files, and in each txt file it has a list of all the names of the machines. Depending on which file the machine name is in, it goes into a different folder (as some are synced nightly, others weekly, depending on how important they are).
@ECHO OFF
SET _OFFSITEDIR=C:\QNAPBackups\Offsite\
FOR /f "tokens=1 delims=- " %%a in ("%1") DO (
FOR /f "tokens=4 delims=\ " %%b in ("%%a") DO (
FIND /C /I "%%b" C:\Batches\OFFSITE-DB.txt | find ": 1" 1>nul && GOTO Offsite_Database
FIND /C /I "%%b" C:\Batches\OFFSITE-TS.txt | find ": 1" 1>nul && GOTO Offsite_Terminal
FIND /C /I "%%b" C:\Batches\OFFSITE-EX.txt | find ": 1" 1>nul && GOTO Offsite_Exchange
FIND /C /I "%%b" C:\Batches\OFFSITE-A1.txt | find ": 1" 1>nul && GOTO Offsite_AllInOne
FIND /C /I "%%b" C:\Batches\OFFSITE-MS.txt | find ": 1" 1>nul && GOTO Offsite_Miscella
GOTO :NotFound
)
)
:Offsite_Database
MOVE /Y %1 %_OFFSITEDIR%Databases\
GOTO EOF
:Offsite_Terminal
MOVE /Y %1 %_OFFSITEDIR%TerminalServers\
GOTO EOF
:Offsite_Exchange
MOVE /Y %1 %_OFFSITEDIR%Exchange\
GOTO EOF
:Offsite_AllInOne
MOVE /Y %1 %_OFFSITEDIR%AllInOne\
GOTO EOF
:Offsite_Miscella
MOVE /Y %1 %_OFFSITEDIR%Misc\
GOTO EOF
:NotFound
ECHO %1 >> C:\Batches\OFFSITE-NotFound.txt
GOTO EOF
:EOF
forfiles -p %_OFFSITEDIR%Databases\ -m *.rar -d -3 -c "cmd /c del @path"
forfiles -p %_OFFSITEDIR%TerminalServers\ -m *.rar -d -3 -c "cmd /c del @path"
forfiles -p %_OFFSITEDIR%Exchange\ -m *.rar -d -3 -c "cmd /c del @path"
forfiles -p %_OFFSITEDIR%AllInOne\ -m *.rar -d -3 -c "cmd /c del @path"
forfiles -p %_OFFSITEDIR%Misc\ -m *.rar -d -3 -c "cmd /c del @path"