Still looking for a quality backup solution

Discussion in 'backup, imaging & disk mgmt' started by whitedragon551, Oct 21, 2015.

  1. whitedragon551

    whitedragon551 Registered Member

    Joined:
    Sep 30, 2008
    Posts:
    3,264
    Location:
    USA
    I am still looking for a quality backup solution. I was using Paragon, but found it unreliable. It would work great for 3 weeks, then fail, work for 2 weeks then fail, then work for a month and then fail.

    I have since removed it and am on the look again. What I am looking for may not even exist, but its worth a shot anyway.

    I will be backing up to a 2TB RAID0 NAS over Cat5E so speeds are fairly good.

    I want something I can schedule for a full weekly backup and then does incremental for the rest of the week and keep the last 5 full sets of backups. It automatically deletes the oldest backups.

    Would also like something that doesnt use a proprietary backup format. Something generic like a vmkd would be awesome so if I choose I can spin up a VM while I am down.

    Right now I am currently demoing Veeam Endpoint Backup and while Veeam is a great enterprise backup solution, its desktop software leaves a little to be desired in the way of scheduling. However, I will say that it has yet to fail on me like Paragon did in terms of creating backups.
     
  2. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    I can't recommend anything based on your requirements, but a couple of comments.

    1. I would pick first based on reliability, and then see if some of the other issues, are truly that critical. You might look at either Macrium or Shadowprotect.

    2. You mention Paragon failed in terms of creating backups. How about restores. Unless you test that you haven't tested.

    Pete
     
  3. whitedragon551

    whitedragon551 Registered Member

    Joined:
    Sep 30, 2008
    Posts:
    3,264
    Location:
    USA
    I wasnt able to really test anything due to the constant weekly failures. Hence me looking for an alternative. I have been running Veeam for a few days and have already tested it.
     
  4. Gullible Jones

    Gullible Jones Registered Member

    Joined:
    May 16, 2013
    Posts:
    1,466
    @whitedragon551

    I don't know anything about Veeam, but if it has a command line frontend, you could probably use that via the Windows task scheduler for scheduled backups.

    I'm assuming offline backups are ruled out, too.

    Hmm. Maybe this would help: http://windowsir.blogspot.com/2009/11/working-with-volume-shadow-copies.html

    ^^^ Not what you're looking for, but may point in the right direction. What you want might be, say, batch script that
    - Generates a shadow copy
    - Writes the contents to the NAS filesystem
    - Deletes the shadow copy
    and is run at regular intervals via the Windows task scheduler.
     
  5. zapjb

    zapjb Registered Member

    Joined:
    Nov 15, 2005
    Posts:
    5,554
    Location:
    USA still the best. But barely.
    Proprietary format I think but I suggest EaseUS products.
     
  6. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
    whitedragon551,

    You could try the TeraByte Unlimited apps. They do the above including creating a vmdk.
     
    Last edited: Oct 26, 2015
  7. pandlouk

    pandlouk Registered Member

    Joined:
    Jul 15, 2007
    Posts:
    2,976
    Terabyteunlimited Image for windows will do exactly what you seek.
    I use a similar a similar schedule for one of my systems with the following batch
    Code:
    @echo off
    
    :: Copyright (C) 2011-2012, TeraByte Unlimited. All rights reserved.
    :: version 1.2
    
    :: This batch file maintains multiple iterations of a particular backup. Each
    :: time the batch file is run, a backup will be created. The filename will
    :: include the date and time. For example, the first time the batch file is run,
    :: <file name>_2010-04-18-2315__FULL.tbi will be created. On the next run,
    :: <file name>_2010-04-19-2315__FULL.tbi will be created. (Assuming it's run the
    :: next day at the same time.) Once the number of backups reaches the number
    :: specified, the oldest backup (or backup set) is deleted.
    ::
    ::
    :: There are several settings you need to specify below.
    :: Each one is preceded by the "set" command.
    
    :: ---------------------------------------------------------------------------
    
    :: Specify the folder where backup files will be saved. In all cases, omit the
    :: trailing backslash, even for root directories (e.g. C: or D:). Folder
    :: path can include spaces.
    ::
    :: A UNC path can also be specified for this variable. NOTE: Make sure the share
    :: is accessible or IFWRotate and/or Image for Windows may not function as expected.
    :: If necessary, use the TBILogin variable below to specify the network share
    :: login details. If IFWRotate cannot access the path it will be unable to count the
    :: previous image backups, which will result in only Full images being created and
    :: no images being deleted. In this case, it may be necessary to add credentials
    :: for the share to the user account running IFWRotate.
    ::
    :: Example: set TBIBase=D:\My Backups
    ::
    :: Example: set TBIBase=\\server\backups\mybackups
    
    set TBIBase=
    
    
    
    :: Specify the desired backup filename below. In all cases, omit
    :: the file extension. Filename can include spaces. This is the "base"
    :: filename used for creating the Full and Incremental filenames.
    ::
    :: Backup images will have the same "base" name as the specified TBIName value
    :: with the date, time, and "__FULL" appended (for Full images) or "_INCR_", date,
    :: and time appended (for Incremental images).
    ::
    :: Created Full image filename example: WorkComputer_2010-04-20-1754__FULL.tbi
    ::
    :: Created Incremental image filename example: WorkComputer_2010-04-20-1754_INCR_2010-04-21-1754.tbi
    ::
    :: Example: set TBIName=WorkComputer
    
    set TBIName=
    
    
    
    :: Specify the parameters that should be used by IFW below. This is
    :: where you specify the source drive and partition for the backup. Do not
    :: include the "/f" option. It will be included automatically.
    ::
    :: Note: If you need to use the Image for Windows "/login" option to access a network share,
    :: use the TBILogin script variable below instead of specifying /login here.
    ::
    :: Example: set TBIParms=/b /d:w0@0x1
    
    set TBIParms=
    
    
    
    :: Specify the path to Image for Windows (IMAGEW.EXE).
    :: Note: Set this path only if not using the default installation path.
    :: Do not include a trailing backslash. Do not include any spaces before or after the equals sign.
    :: Omit quotation marks and the trailing backslash.
    ::
    :: Example: set TBIPath=C:\Program Files (x86)\TeraByte Unlimited\Image for Windows\V2
    
    set TBIPath=
    
    
    
    :: Specify the maximum number of Full image files to be saved. The oldest
    :: Full image file (along with any associated Incremental images) will be
    :: deleted when this value is exceeded. Number must be between 2 and 99.
    ::
    :: Note: If the number of existing backup sets (Fulls or Fulls + Incrementals) exceed
    :: the number specified, the older sets will be deleted when a new Full is created.
    :: This may result in multiple sets being deleted. For example, if you had a previous
    :: maximum of 7 and changed it to 3, the oldest sets will be deleted to bring
    :: the count down to the new maximum of 3 when a new Full is created.
    ::
    :: Example: Set TBIMaxFullCnt=4
    
    set TBIMaxFullCnt=4
    
    
    
    :: Specify the maximum number of Incremental image backups to be created for
    :: each Full backup. A setting of 0 (zero) will create only Full image backups.
    :: If you want to create Incremental backups, set the value to 1 or higher (max. 99).
    ::
    :: Example: set TBIMaxINCRCnt=6
    
    set TBIMaxINCRCnt=6
    
    
    
    :: Specify any parameters needed when creating a Incremental backup. Don't
    :: include the "/b", "/base", or "/f" options as those are automatically
    :: included. For example, you may want to verify the image after it's created.
    ::
    :: Note: If you need to use the Image for Windows "/login" option to access a network share,
    :: use the TBILogin script variable below instead of specifying /login here.
    ::
    :: Example: set TBIIncParms=/v
    ::
    
    set TBIIncParms=
    
    
    
    :: Specify the network login details (if needed to access a network share). Do not set
    :: if network login is not required.
    ::
    :: If you include the login details here, don't include them in TBIParms or TBIIncParms.
    :: See the Image for Windows manual for details using the /login parameter.
    ::
    :: Note: When this variable is used the script must be run with administrator privileges.
    ::
    :: Example: set TBILogin=/login:"\\server\share*username*password"
    :: Example: set TBILogin=/login:"\\BackupServer\Win7Backups*JohnSmith*mypassword"
    
    set TBILogin=
    
    
    
    :: ====================================================
    :: Command line options for this script file
    :: ====================================================
    ::
    :: /f Forces a new Full image to be created. Rotation rules for the
    :: maximum number of Full images will still be enforced.
    ::
    :: /d Forces a new Incremental image to be created. Using this option
    :: will create a Incremental image even if it will exceed the maximum
    :: number specified.
    ::
    :: Note: The Incremental image will be based on the newest Full image.
    :: If no Full image exists, a Full image will be created instead.
    ::
    ::
    
    :: ###########################################################################
    :: #
    :: # NO CHANGES SHOULD BE NEEDED PAST THIS POINT
    :: #
    :: ###########################################################################
    
    :: Check for Windows 2000 or later
    
    if not "%OS%"=="Windows_NT" goto :NoWin
    
    :: ---------------------------------------------------------------------------
    
    :: Init vars
    
    setlocal enableextensions enabledelayedexpansion
    
    if "%INCRotate%"=="" for /f "usebackq tokens=2,*" %%G in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\TeraByte Unlimited\Image\ExternVars" 2^> nul ^| find "INCRotate"`) do set INCRotate=%%H
    set Error=X
    set Number1=X
    set Number2=X
    set TBICmd=X
    set TBIOldest=X
    set TBINewest=X
    
    if %TBIMaxFullCnt% LSS 2 set /a TBIMaxFullCnt=2
    if %TBIMaxFullCnt% GTR 99 set /a TBIMaxFullCnt=99
    if %TBIMaxINCRCnt% LSS 0 set /a TBIMaxINCRCnt=0
    if %TBIMaxINCRCnt% GTR 99 set /a TBIMaxINCRCnt=99
    
    if not defined TBIBase echo No TBIBase parameter supplied. Please edit: %0 & goto :End
    if not defined TBIName echo No TBIName parameter supplied. Please edit: %0 & goto :End
    if not defined TBIParms echo No TBIParms parameter supplied. Please edit: %0 & goto :End
    if not defined TBIMaxFullCnt echo No TBIMaxFullCnt parameter supplied. Please edit: %0 & goto :End
    if not defined TBIMaxINCRCnt echo No TBIMaxINCRCnt parameter supplied. Please edit: %0 & goto :End
    
    :: ---------------------------------------------------------------------------
    
    if "%TBIPath:~0,1%"==" " (set TBIPath=)
    if "%TBIPath%"=="" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set TBIPath=C:\Program Files (x86)\TeraByte Unlimited\Image for Windows\V2
    if "%TBIPath%"=="" set TBIPath=C:\Program Files\TeraByte Unlimited\Image for Windows\V2
    if not exist "%TBIPath%\imagew.exe" echo Unable to find 'imagew.exe' in the following path: & echo %TBIPath% & echo. & echo Please edit %0 and check TBIPath value. & goto :End
    
    :: ---------------------------------------------------------------------------
    
    :: Log into network share
    
    if "%TBILogin:~0,1%"==" " (set TBILogin=)
    if defined TBILogin start "" /min /wait "%TBIPath%\imagew.exe" %TBILogin% /log:0 /quit
    
    :: Get Full image file counts
    
    set /a Number1=0
    if exist "%TBIBase%\%TBIName%_*__FULL.tbi" for /f "delims=" %%a in ('dir "%TBIBase%\%TBIName%_*__FULL.tbi" /o-d /b /p /-p /w /-w') do (set TBIOldest=%%a) & (set /a Number1=!Number1!+1) & (if "!TBINewest!"=="X" set TBINewest=%%a)
    set TBIFullCnt=%Number1%
    echo.
    echo Number of Full images found in set: %TBIFullCnt%
    if "%TBINewest%"=="X" set TBINewest=(none)
    if "%TBIOldest%"=="X" set TBIOldest=(none)
    echo Oldest Full image set found: %TBIOldest%
    echo Newest Full image set found: %TBINewest%
    
    :: Get INCR image file counts for newest set
    
    set TBINewest=%TBINewest:~0,-10%
    set /a Number1=0
    if exist "%TBIBase%\%TBINewest%_INCR*.tbi" for /f %%a in ('dir "%TBIBase%\%TBINewest%_INCR*.tbi" /o-d /b /p /-p /w /-w') do (set /a Number1=!Number1!+1)
    set TBIINCRCnt=%Number1%
    echo.
    echo Number of Incremental images found in newest Full set: %TBIINCRCnt% of %TBIMaxINCRCnt%
    
    :: Check which type of backup (Full or INCR) needs to be created
    
    if /i "%1"=="/f" goto :CreateFull
    if %TBIFullCnt%==0 goto :CreateFull
    if /i "%1"=="/d" goto :CreateINCR
    if %TBIINCRCnt% LSS %TBIMaxINCRCnt% goto :CreateINCR
    goto :CreateFull
    
    :CreateINCR
    
    echo.
    echo Create Incremental Image
    if not exist "%INCRotate%.tbi" goto:CreateFull
    echo -- Running command: "%TBIPath%\imagew.exe" /b %TBIIncParms% /base:"$~INCRotate$" /f:"%TBIBase%\%TBINewest%_INCR_$~YYYY$-$~MM$-$~DD$-$~HHMM$" /hash /savename:INCRotate
    start "" /wait "%TBIPath%\imagew.exe" /b %TBIIncParms% /base:"$~INCRotate$" /f:"%TBIBase%\%TBINewest%_INCR_$~YYYY$-$~MM$-$~DD$-$~HHMM$" /hash /savename:INCRotate
    goto :PostBkup
    
    :CreateFull
    
    if %TBIFullCnt% LSS %TBIMaxFullCnt% goto :CreateFullImage
    echo.
    echo Number of Full images will exceed %TBIMaxFullCnt%.
    echo Deleting oldest Full image set: %TBIOldest%
    del "%TBIBase%\%TBIOldest%"
    set TBIOldest=%TBIOldest:~0,-10%
    if exist "%TBIBase%\%TBIOldest%_INCR*.tbi" del "%TBIBase%\%TBIOldest%_INCR*.tbi"
    if exist "%TBIBase%\%TBIOldest%_INCR*.#*" del "%TBIBase%\%TBIOldest%_INCR*.#*"
    if exist "%TBIBase%\%TBIOldest%__FULL.#*" del "%TBIBase%\%TBIOldest%__FULL.#*"
    :: Check if additional old backup sets need deleted
    set /a Number1=0
    if exist "%TBIBase%\%TBIName%_*__FULL.tbi" for /f "delims=" %%a in ('dir "%TBIBase%\%TBIName%_*__FULL.tbi" /o-d /b /p /-p /w /-w') do (set TBIOldest=%%a) & (set /a Number1=!Number1!+1)
    set TBIFullCnt=%Number1%
    if %TBIFullCnt% LSS %TBIMaxFullCnt% goto :CreateFullImage
    goto :CreateFull
    
    
    :CreateFullImage
    
    echo.
    echo Create Full Image
    echo -- Running command: "%TBIPath%\imagew.exe" %TBIParms% /f:"%TBIBase%\%TBIName%_$~YYYY$-$~MM$-$~DD$-$~HHMM$__FULL" /hash /savename:INCRotate
    start "" /wait "%TBIPath%\imagew.exe" %TBIParms% /f:"%TBIBase%\%TBIName%_$~YYYY$-$~MM$-$~DD$-$~HHMM$__FULL" /hash /savename:INCRotate
    goto :PostBkup
    
    
    :: ---------------------------------------------------------------------------
    
    :PostBkup
    
    set Error=%ERRORLEVEL%
    
    echo.
    echo #########################################
    if not "%Error%"=="0" echo # The following error was reported: %Error%
    if "%Error%"=="0" echo # No errors were reported.
    echo #########################################
    echo.
    
    goto :End
    
    
    :: ---------------------------------------------------------------------------
    
    :NoWin
    
    echo.
    echo Windows 2000 or later is required for this script.
    echo.
    goto :End
    
    
    :: ---------------------------------------------------------------------------
    
    :End
    
    set Error=
    set Number1=
    set Number2=
    set TBIFullCnt=
    set TBIINCRCnt=
    set TBICmd=
    set TBIOldest=
    set TBINewest=
    
    endlocal
    
    set TBIBase=
    set TBIName=
    set TBIParms=
    set TBIPath=
    set TBIMaxFullCnt=
    set TBIMaxINCRCnt=
    set TBIIncParms=
    set TBILogin=
    
    :: End of batch script
    
     
  8. ArchiveX

    ArchiveX Registered Member

    Joined:
    Apr 7, 2014
    Posts:
    1,501
    Location:
    .

    Paragon unreliable?

    Really
    ?

    How things change...:isay:
     
    Last edited: Nov 5, 2015
  9. whitedragon551

    whitedragon551 Registered Member

    Joined:
    Sep 30, 2008
    Posts:
    3,264
    Location:
    USA
    It randomly decides mapped network drives do not exist.
     
  10. whitedragon551

    whitedragon551 Registered Member

    Joined:
    Sep 30, 2008
    Posts:
    3,264
    Location:
    USA
    Thanks,

    How does one set a schedule? Im on a trial right now of Image for Windows. I tried to run a manual backup and got told that the C drive couldnt be locked and asked if I wanted to force it or quit. Is this normal?
     
  11. pandlouk

    pandlouk Registered Member

    Joined:
    Jul 15, 2007
    Posts:
    2,976
    You are welcome.

    IFW uses the windows schedule. You can add/remove a schedule from the "settings"->"schedule tasks" or at the last step when you perform a manual backup by clicking "schedule backup",

    Can you post a screenshot of the "settings" ->"PHYLock/VSS" tab? Probably the boxe/s "use when locking fails" are unchecked. (If you wish to use only VSS and not phylock you should also check the box "Disable usage" for phylock.

    Panagiotis
     
  12. whitedragon551

    whitedragon551 Registered Member

    Joined:
    Sep 30, 2008
    Posts:
    3,264
    Location:
    USA
    The steps Im following are go to Image for Windows > Backup Full > PHYLock/VSS > Check Disable Usage under PhyLock > Chekc use VSS When available and everything except use if locking fails.
     
  13. whitedragon551

    whitedragon551 Registered Member

    Joined:
    Sep 30, 2008
    Posts:
    3,264
    Location:
    USA
    Also how do I save and use the script above? Is that just a .bat file that I use and schedule?
     
  14. pandlouk

    pandlouk Registered Member

    Joined:
    Jul 15, 2007
    Posts:
    2,976
    If you do not select "use when locking fails" IFW will give you that message (continue or quit). If you enable "use when locking fails" under VSS it will automatically call VSS, lock the partition/s and perform the backup.

    Panagiotis
     
  15. pandlouk

    pandlouk Registered Member

    Joined:
    Jul 15, 2007
    Posts:
    2,976
    Yes save it anywhere you want as a .bat and you schedule that bat.
    For avoiding mistakes when modifying the settings of the batch,
    perform a manual backup of the partition/s that you want to backup... deselect simple operations (if you used those) select full backup proceed to the steps of what to backup and where and at the last step with "Backup options" click on "Show Command", check "save to file" and press OK... IFW will display the command line with your settings for that backup and you'll use that simple batch as a guide of what settings you must use in the above incremental batch.

    Panagiotis
     
  16. whitedragon551

    whitedragon551 Registered Member

    Joined:
    Sep 30, 2008
    Posts:
    3,264
    Location:
    USA
    Using the script above I am getting the following error:
     

    Attached Files:

  17. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    12,115
    Location:
    NSW, Australia
    whitedragon551,

    What do you have for...

    set TBIBase=

    set TBIName=

    set TBIParms=

    Is there an error in the Command Prompt window?
     
    Last edited: Nov 11, 2015
  18. whitedragon551

    whitedragon551 Registered Member

    Joined:
    Sep 30, 2008
    Posts:
    3,264
    Location:
    USA
    TBIBase="\\NAS\Backups\Full Backups"
    TBIName=Wolverine (My gaming laptop name)
    TBIParms=/b /d:w0 (C Drive)

    No error in the cmd prompt window.

    Also is there a spot at Terabyte for other backup scripts such as the one in this thread?
     
  19. pandlouk

    pandlouk Registered Member

    Joined:
    Jul 15, 2007
    Posts:
    2,976
    Change the TBIBase from
    TBIBase="\\NAS\Backups\Full Backups"
    to
    TBIBase=\\NAS\Backups\Full Backups

    For additional scripts check http://www.terabyteunlimited.com/downloads-image-for-windows.htm#addon (under additional items) and the terabyte's forum http://www.terabyteunlimited.com/ucf/viewforum.php?f=5

    Panagiotis
     
  20. whitedragon551

    whitedragon551 Registered Member

    Joined:
    Sep 30, 2008
    Posts:
    3,264
    Location:
    USA
    Looks like the job completed successfully.

    I do have a random file called WOLVERINE_2015-11-12-0200__FULL.#0

    Im not doing any incrementals. Its supposed to be a full backup each day for 7 running days.
     
  21. pandlouk

    pandlouk Registered Member

    Joined:
    Jul 15, 2007
    Posts:
    2,976
    That is the hash file. It speeds up the creation of differentials and incrementals (especially on network shares it is very handy)
    if you do not want hashes to be created use the following script
    Code:
    @echo off
    
    :: Copyright (C) 2011-2012, TeraByte Unlimited. All rights reserved.
    :: version 1.2
    
    :: This batch file maintains multiple iterations of a particular backup. Each
    :: time the batch file is run, a backup will be created. The filename will
    :: include the date and time. For example, the first time the batch file is run,
    :: <file name>_2010-04-18-2315__FULL.tbi will be created. On the next run,
    :: <file name>_2010-04-19-2315__FULL.tbi will be created. (Assuming it's run the
    :: next day at the same time.) Once the number of backups reaches the number
    :: specified, the oldest backup (or backup set) is deleted.
    ::
    ::
    :: There are several settings you need to specify below.
    :: Each one is preceded by the "set" command.
    
    :: ---------------------------------------------------------------------------
    
    :: Specify the folder where backup files will be saved. In all cases, omit the
    :: trailing backslash, even for root directories (e.g. C: or D:). Folder
    :: path can include spaces.
    ::
    :: A UNC path can also be specified for this variable. NOTE: Make sure the share
    :: is accessible or IFWRotate and/or Image for Windows may not function as expected.
    :: If necessary, use the TBILogin variable below to specify the network share
    :: login details. If IFWRotate cannot access the path it will be unable to count the
    :: previous image backups, which will result in only Full images being created and
    :: no images being deleted. In this case, it may be necessary to add credentials
    :: for the share to the user account running IFWRotate.
    ::
    :: Example: set TBIBase=D:\My Backups
    ::
    :: Example: set TBIBase=\\server\backups\mybackups
    
    set TBIBase=
    
    
    
    :: Specify the desired backup filename below. In all cases, omit
    :: the file extension. Filename can include spaces. This is the "base"
    :: filename used for creating the Full and Incremental filenames.
    ::
    :: Backup images will have the same "base" name as the specified TBIName value
    :: with the date, time, and "__FULL" appended (for Full images) or "_INCR_", date,
    :: and time appended (for Incremental images).
    ::
    :: Created Full image filename example: WorkComputer_2010-04-20-1754__FULL.tbi
    ::
    :: Created Incremental image filename example: WorkComputer_2010-04-20-1754_INCR_2010-04-21-1754.tbi
    ::
    :: Example: set TBIName=WorkComputer
    
    set TBIName=
    
    
    
    :: Specify the parameters that should be used by IFW below. This is
    :: where you specify the source drive and partition for the backup. Do not
    :: include the "/f" option. It will be included automatically.
    ::
    :: Note: If you need to use the Image for Windows "/login" option to access a network share,
    :: use the TBILogin script variable below instead of specifying /login here.
    ::
    :: Example: set TBIParms=/b /d:w0@0x1
    
    set TBIParms=
    
    
    
    :: Specify the path to Image for Windows (IMAGEW.EXE).
    :: Note: Set this path only if not using the default installation path.
    :: Do not include a trailing backslash. Do not include any spaces before or after the equals sign.
    :: Omit quotation marks and the trailing backslash.
    ::
    :: Example: set TBIPath=C:\Program Files (x86)\TeraByte Unlimited\Image for Windows\V2
    
    set TBIPath=
    
    
    
    :: Specify the maximum number of Full image files to be saved. The oldest
    :: Full image file (along with any associated Incremental images) will be
    :: deleted when this value is exceeded. Number must be between 2 and 99.
    ::
    :: Note: If the number of existing backup sets (Fulls or Fulls + Incrementals) exceed
    :: the number specified, the older sets will be deleted when a new Full is created.
    :: This may result in multiple sets being deleted. For example, if you had a previous
    :: maximum of 7 and changed it to 3, the oldest sets will be deleted to bring
    :: the count down to the new maximum of 3 when a new Full is created.
    ::
    :: Example: Set TBIMaxFullCnt=4
    
    set TBIMaxFullCnt=4
    
    
    
    :: Specify the maximum number of Incremental image backups to be created for
    :: each Full backup. A setting of 0 (zero) will create only Full image backups.
    :: If you want to create Incremental backups, set the value to 1 or higher (max. 99).
    ::
    :: Example: set TBIMaxINCRCnt=6
    
    set TBIMaxINCRCnt=6
    
    
    
    :: Specify any parameters needed when creating a Incremental backup. Don't
    :: include the "/b", "/base", or "/f" options as those are automatically
    :: included. For example, you may want to verify the image after it's created.
    ::
    :: Note: If you need to use the Image for Windows "/login" option to access a network share,
    :: use the TBILogin script variable below instead of specifying /login here.
    ::
    :: Example: set TBIIncParms=/v
    ::
    
    set TBIIncParms=
    
    
    
    :: Specify the network login details (if needed to access a network share). Do not set
    :: if network login is not required.
    ::
    :: If you include the login details here, don't include them in TBIParms or TBIIncParms.
    :: See the Image for Windows manual for details using the /login parameter.
    ::
    :: Note: When this variable is used the script must be run with administrator privileges.
    ::
    :: Example: set TBILogin=/login:"\\server\share*username*password"
    :: Example: set TBILogin=/login:"\\BackupServer\Win7Backups*JohnSmith*mypassword"
    
    set TBILogin=
    
    
    
    :: ====================================================
    :: Command line options for this script file
    :: ====================================================
    ::
    :: /f Forces a new Full image to be created. Rotation rules for the
    :: maximum number of Full images will still be enforced.
    ::
    :: /d Forces a new Incremental image to be created. Using this option
    :: will create a Incremental image even if it will exceed the maximum
    :: number specified.
    ::
    :: Note: The Incremental image will be based on the newest Full image.
    :: If no Full image exists, a Full image will be created instead.
    ::
    ::
    
    :: ###########################################################################
    :: #
    :: # NO CHANGES SHOULD BE NEEDED PAST THIS POINT
    :: #
    :: ###########################################################################
    
    :: Check for Windows 2000 or later
    
    if not "%OS%"=="Windows_NT" goto :NoWin
    
    :: ---------------------------------------------------------------------------
    
    :: Init vars
    
    setlocal enableextensions enabledelayedexpansion
    
    if "%INCRotate%"=="" for /f "usebackq tokens=2,*" %%G in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\TeraByte Unlimited\Image\ExternVars" 2^> nul ^| find "INCRotate"`) do set INCRotate=%%H
    set Error=X
    set Number1=X
    set Number2=X
    set TBICmd=X
    set TBIOldest=X
    set TBINewest=X
    
    if %TBIMaxFullCnt% LSS 2 set /a TBIMaxFullCnt=2
    if %TBIMaxFullCnt% GTR 99 set /a TBIMaxFullCnt=99
    if %TBIMaxINCRCnt% LSS 0 set /a TBIMaxINCRCnt=0
    if %TBIMaxINCRCnt% GTR 99 set /a TBIMaxINCRCnt=99
    
    if not defined TBIBase echo No TBIBase parameter supplied. Please edit: %0 & goto :End
    if not defined TBIName echo No TBIName parameter supplied. Please edit: %0 & goto :End
    if not defined TBIParms echo No TBIParms parameter supplied. Please edit: %0 & goto :End
    if not defined TBIMaxFullCnt echo No TBIMaxFullCnt parameter supplied. Please edit: %0 & goto :End
    if not defined TBIMaxINCRCnt echo No TBIMaxINCRCnt parameter supplied. Please edit: %0 & goto :End
    
    :: ---------------------------------------------------------------------------
    
    if "%TBIPath:~0,1%"==" " (set TBIPath=)
    if "%TBIPath%"=="" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set TBIPath=C:\Program Files (x86)\TeraByte Unlimited\Image for Windows\V2
    if "%TBIPath%"=="" set TBIPath=C:\Program Files\TeraByte Unlimited\Image for Windows\V2
    if not exist "%TBIPath%\imagew.exe" echo Unable to find 'imagew.exe' in the following path: & echo %TBIPath% & echo. & echo Please edit %0 and check TBIPath value. & goto :End
    
    :: ---------------------------------------------------------------------------
    
    :: Log into network share
    
    if "%TBILogin:~0,1%"==" " (set TBILogin=)
    if defined TBILogin start "" /min /wait "%TBIPath%\imagew.exe" %TBILogin% /log:0 /quit
    
    :: Get Full image file counts
    
    set /a Number1=0
    if exist "%TBIBase%\%TBIName%_*__FULL.tbi" for /f "delims=" %%a in ('dir "%TBIBase%\%TBIName%_*__FULL.tbi" /o-d /b /p /-p /w /-w') do (set TBIOldest=%%a) & (set /a Number1=!Number1!+1) & (if "!TBINewest!"=="X" set TBINewest=%%a)
    set TBIFullCnt=%Number1%
    echo.
    echo Number of Full images found in set: %TBIFullCnt%
    if "%TBINewest%"=="X" set TBINewest=(none)
    if "%TBIOldest%"=="X" set TBIOldest=(none)
    echo Oldest Full image set found: %TBIOldest%
    echo Newest Full image set found: %TBINewest%
    
    :: Get INCR image file counts for newest set
    
    set TBINewest=%TBINewest:~0,-10%
    set /a Number1=0
    if exist "%TBIBase%\%TBINewest%_INCR*.tbi" for /f %%a in ('dir "%TBIBase%\%TBINewest%_INCR*.tbi" /o-d /b /p /-p /w /-w') do (set /a Number1=!Number1!+1)
    set TBIINCRCnt=%Number1%
    echo.
    echo Number of Incremental images found in newest Full set: %TBIINCRCnt% of %TBIMaxINCRCnt%
    
    :: Check which type of backup (Full or INCR) needs to be created
    
    if /i "%1"=="/f" goto :CreateFull
    if %TBIFullCnt%==0 goto :CreateFull
    if /i "%1"=="/d" goto :CreateINCR
    if %TBIINCRCnt% LSS %TBIMaxINCRCnt% goto :CreateINCR
    goto :CreateFull
    
    :CreateINCR
    
    echo.
    echo Create Incremental Image
    if not exist "%INCRotate%.tbi" goto:CreateFull
    echo -- Running command: "%TBIPath%\imagew.exe" /b %TBIIncParms% /base:"$~INCRotate$" /f:"%TBIBase%\%TBINewest%_INCR_$~YYYY$-$~MM$-$~DD$-$~HHMM$" /savename:INCRotate
    start "" /wait "%TBIPath%\imagew.exe" /b %TBIIncParms% /base:"$~INCRotate$" /f:"%TBIBase%\%TBINewest%_INCR_$~YYYY$-$~MM$-$~DD$-$~HHMM$" /savename:INCRotate
    goto :PostBkup
    
    :CreateFull
    
    if %TBIFullCnt% LSS %TBIMaxFullCnt% goto :CreateFullImage
    echo.
    echo Number of Full images will exceed %TBIMaxFullCnt%.
    echo Deleting oldest Full image set: %TBIOldest%
    del "%TBIBase%\%TBIOldest%"
    set TBIOldest=%TBIOldest:~0,-10%
    if exist "%TBIBase%\%TBIOldest%_INCR*.tbi" del "%TBIBase%\%TBIOldest%_INCR*.tbi"
    if exist "%TBIBase%\%TBIOldest%_INCR*.#*" del "%TBIBase%\%TBIOldest%_INCR*.#*"
    if exist "%TBIBase%\%TBIOldest%__FULL.#*" del "%TBIBase%\%TBIOldest%__FULL.#*"
    :: Check if additional old backup sets need deleted
    set /a Number1=0
    if exist "%TBIBase%\%TBIName%_*__FULL.tbi" for /f "delims=" %%a in ('dir "%TBIBase%\%TBIName%_*__FULL.tbi" /o-d /b /p /-p /w /-w') do (set TBIOldest=%%a) & (set /a Number1=!Number1!+1)
    set TBIFullCnt=%Number1%
    if %TBIFullCnt% LSS %TBIMaxFullCnt% goto :CreateFullImage
    goto :CreateFull
    
    
    :CreateFullImage
    
    echo.
    echo Create Full Image
    echo -- Running command: "%TBIPath%\imagew.exe" %TBIParms% /f:"%TBIBase%\%TBIName%_$~YYYY$-$~MM$-$~DD$-$~HHMM$__FULL" /savename:INCRotate
    start "" /wait "%TBIPath%\imagew.exe" %TBIParms% /f:"%TBIBase%\%TBIName%_$~YYYY$-$~MM$-$~DD$-$~HHMM$__FULL" /savename:INCRotate
    goto :PostBkup
    
    
    :: ---------------------------------------------------------------------------
    
    :PostBkup
    
    set Error=%ERRORLEVEL%
    
    echo.
    echo #########################################
    if not "%Error%"=="0" echo # The following error was reported: %Error%
    if "%Error%"=="0" echo # No errors were reported.
    echo #########################################
    echo.
    
    goto :End
    
    
    :: ---------------------------------------------------------------------------
    
    :NoWin
    
    echo.
    echo Windows 2000 or later is required for this script.
    echo.
    goto :End
    
    
    :: ---------------------------------------------------------------------------
    
    :End
    
    set Error=
    set Number1=
    set Number2=
    set TBIFullCnt=
    set TBIINCRCnt=
    set TBICmd=
    set TBIOldest=
    set TBINewest=
    
    endlocal
    
    set TBIBase=
    set TBIName=
    set TBIParms=
    set TBIPath=
    set TBIMaxFullCnt=
    set TBIMaxINCRCnt=
    set TBIIncParms=
    set TBILogin=
    
    :: End of batch script
     
    Last edited: Nov 12, 2015
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.