Back up to Alternating Locations

Overview

In a typical backup rotation scenario you may have two (or more) external USB drives that are rotated on a weekly basis. You would store the external drive that is not currently in use off-site for extra security.

This example uses two external USB drives that when connected to your PC, appear as drive E: and drive F:.  Your images of drive C: are saved to E:\Images and F:\Images and Macrium Reflect saves your image files to whichever drive is currently connected to your PC.

To use VBScript to detect which drive and run the appropriate backup

  1. Create two XML backup definitions as follows:

  2. Right-click Image to E.xml and select Generate a VBScript file.

    and click OK.

  3. Accept the defaults and click OK.

  4. In the VBScript Files tab, right-click VBScript file and select Edit.



    The VBScript file opens in the system default text editor, generally this is Notepad.

  5. For clarity, switch off word wrap. In notepad, choose Edit > Word Wrap.

  6. Edit the file in notepad as follows:

    Replace the line:

    ExitCode = Backup ("""C:\Program Files\Macrium\Reflect\reflect.exe"" -e -w <BACKUP_TYPE> ""c:\users\nick\documents\reflect\Image to E.xml""")


    With the following lines:

    If DoesDirExist("E:\") = true Then
    ExitCode = Backup ("""C:\Program Files\Macrium\Reflect\reflect.exe"" -e -w ""c:\users\nick\documents\reflect\Image to E.xml""")
    Else
    ExitCode = Backup ("""C:\Program Files\Macrium\Reflect\reflect.exe"" -e -w ""c:\users\nick\documents\reflect\Image to F.xml""")
    End If
     

    Note: Replace XML path and file names with the correct names for your scenario.

    At the end of the VBScript source paste the following lines:

    Function DoesDirExist(byVal pathname)

        Dim objFSO

        Set objFSO = CreateObject("Scripting.FileSystemObject")

        DoesDirExist = objFSO.FolderExists(pathname)

        Set objFSO = Nothing

    End Function

  7. Save the file.

  8. Execute or schedule the VBScript source file in exactly the same way as a backup definition file . See Schedule backups