VMWare : VCB Cleanup Script

VMWare : VCB Cleanup Script

VCB is a powerful and useful technology for backing up Virtual Machines running on ESX/vSphere, more than once it has rescued an entire Virtual Machin where a standalone server would have had to be rebuilt.

My only fault with the ‘vanilla’ installation is the cleanup process. Whena  VCB backup fails, or even succeeds at times, the snapshot is not cleaned up on the VCB proxy server or the ESX host. This can result in wastedstorage on both systems.

VCB includes a cleanup script which will clean directories in the VCB root folder as specified in the following file: C:\Program Files\VMware\VMware Consolidated Backup Framework\config\config.js

This script works well at cleaning up folders for VCB that are created dynamically in the root folder, however, if you have created subdirectories for per-VCB tasks the script will not automatically cleanup the VCB snapshots. I create a sub-folder on a per-VCB basis, why? This is simple,. because using HP dataprotector to perform VCB backups I have to specify a folder that exists tobackup to tape. If I specify the VCB root folder then if a VCB fails and the data is not cleaned up, the next VCB will be significantly larger as it will contain the data for the failed VCB snapshot and the new VCB snapshot.

I have around 50 VM’s, therefore manually editing the VCB config.js file to reflect the root VCB directory for each backup was a no-no.

You’ll find a link below to a modified version of the vcb-cleanup.wsf file included with the VCB proxy package. Copy this file to the ‘C:\Program Files\VMware\VMware Consolidated Backup Framework\generic’ directory.

Modify the  C:\Program Files\VMware\VMware Consolidated Backup Framework\config\config.js file to reflect the root cotainer for all of your VCB folders.

Follow the steps outlined below to perform VCB cleanup on all subfolders:

  1. Ensure no VCB backups are in progress
  2. Open a command prompt, cd to  “C:\Program Files\VMware\VMware Consolidated Backup Framework\generic”
  3. Execute the following command “cscript.exe vcb-cleanup-mod.wsf “C:\Program Files\VMware\VMware Consolidated Backup Framework”  -y”

Download the script from here. Not, you will need to rename the file from ‘.txt‘ to ‘.wsf

In order for VCB to work under Windows 2008 R2 x64 you must configure vcbMounter.exe to “Run As Administartor”