VMWare Consolidated Backups Script VCB Free- UPDATE
Symantec Backup Exec alternative FREE - Update
Hello again all! I havent blogged in a couple of months so I thought I would give you all an updated script for the VMWare Consolidated Backup's script which was origionaly created.
One point before we go on:
VMWare hace confirmed that because VSphere now has the funcionality to do VCBackups they will soon be ending support for the VCB client. Rubbish I say because we have found after much perserverance that the built in functionality is a little glitchy so we went back to using the VCB installer with our script.. Which in turn pushed for a little more development.
This script can be used with scheduled tasks to automate week / months of backups and maintain your file-structure whilst tidying up old backups.
Code:
@echo off
echo Developed by:
echo Mike Wroughtron
REM ===============================================================
REM ===============================================================
REM This script takes an argument in the form of a virtual server's hostname,
REM it will then remove an old backup if it exists and take a new backup
if [%1] == [] goto HELPER
if [%2] == [] goto HELPER
if [%3] == [] goto HELPER
if [%4] == [] goto HELPER
goto ERRORCHECKED
:HELPER
echo "***********************************************************"
echo "* Your command line is wrong, you need to enter... *"
echo "* vmbackup server frequency interval vsphere *"
echo "* *"
echo "* server should be the server to back up *"
echo "* frequency should be day, week, or month *"
echo "* interval should be the number of backups to take *"
echo "* vsphere should be the management server to connect to *"
echo "***********************************************************
goto FINISHED
:ERRORCHECKED
REM ############CHANGE THE BELOW VARIABLES#############
SET USERNAME=buexec
SET PASSWORD=Cry!baby
SET VCBPATH=C:\Program Files (x86)\VMware\VMware Consolidated Backup Framework\vcbmounter
REM ##############################################
REM ############CHANGE THE BELOW SETTING##############
REM Change this to the path of you stored imagesE:cd E:\Backups
REM ##############################################
REM ############CHANGE THE BELOW SETTING##############
REM Change to your stored directory
SET DIRECTORYPATH=E:\Backups
REM ##############################################
REM ===============================================================
REM ===============================================================
REM SET UP THE VARIABLES FOR THE "FOR LOOP"REM ***************************************
REM : SET LOOPVAR to the ammount of weeks / days
SET /A LOOPVAR=%3 + 1
IF EXIST %DIRECTORYPATH%\%1-%2-%3 rmdir %DIRECTORYPATH%\%1-%2-%3:BEGINING
REM : Check to see if loopvar is greater than 1
IF %LOOPVAR% lss 1 GOTO ENDLOOPVAR
IF %LOOPVAR% gtr 0 GOTO LOOPER
REM : Start loopvar:LOOPER
SET /A LOOPVAR=%LOOPVAR% - 1
SET /A LOOPVARINC=%LOOPVAR% + 1
REN %DIRECTORYPATH%\%1-%2-%LOOPVAR% %1-%2-%LOOPVARINC%
goto BEGINING
:ENDLOOPVAR"%VCBPATH%" -h %4 -m nbd -u %USERNAME% -p %PASSWORD% -a ipaddr:%1 -r "%DIRECTORYPATH%\%1-%2-1" -t fullvm
:FINISHED
Prerequisites:
- Vmware Consolidated Backup (FREE)
Instillation Instructions
- Copy and paste this script in to notepad
- Save the file to C:\Windows on one of your servers (Your backup server) called VCBImage.cmd
Execute Program : C:\windows\VCBImage.cmd from command line
Parameters: {ServerName} {Frequency} {Interval} {VSphere}
The breakdown of this is as follows:
Parameter 1: Your Server Name (The server to backup too)
Parameter 2: A comment, we use WEEK or DAYS, depending how frequent you do VCB Backups
Parameter 3: Interval, how many times you want it backed up. If set to a weekly backup and this is 4 it will keep 4 weeks of backups.
Parameter 4: Vsphere, should be VMWare Management Server to connect too
We use this using scheduled jobs, so we create a scheduled job on our backup server then we create tasks within the job for each server. Choose the CMD file to execute then add you parameters in the parameters field!
Job done 
If you need any help please contact me via our contact form HERE
Enjoy!
Steve,