The university where I contract, has a solution whereby their VCB policies are based on datastores in which the machines are residing in. ie Netbackup will have a policy that calls a VCB script to snapshot all VMs in a datastore.
Except, there’s a small problem – how do you size the holding tank for the image snapshots if all the VMs in a datastore are small system (C:) volumes and their data disks are spread around other datastores?
The aforementioned colleague of mine – Dusan from DMTECH has (with help from the VMware Communities and a little from yours truly) created a VCB script that will sort VMs per datastore based on which datastore their largest VMDK lies in. This means that the holding tank is always, no matter what, smaller than the previous situation required.
The script outputs to to a bunch of csv files (c:\leo as per below) and outputs the name of the machine prefixed with the holding-tank location (in my case V:\VCBholding) and suffixed with the type of backup (in my case -FullVM):
$file = import-csv C:\temp\CustomField.csv
Get-VM | where-object {$file -notmatch $_.name} | %{
$hds = @($_ | Get-HardDisk | Sort-Object -property CapacityKb -descending)
$dsName = ([regex]"^\[(\w+)\]").Match($hds[0].Filename).Groups[1].Value
$name = "V:\VCBholding" + $_.Name + "-FullVM"
$name | Out-File -filePath ("C:\leo" + $dsName + ".txt") -append
}
The contents of those text files can then be directly imported into VCB policies in Netbackup.
N.B. The other thing of note is that you might not want all VMs backed up in VCB – so for that, we use a file which gets read in (c:\temp\CustomField.csv). Into that put in (in CSV format) the names of VMs you want to exclude. ie:
Name virtualmachinename1 virtualmachinename2 virtualmachinename3
One thing to note – the script will not output correctly if you don’t clear the dump folder (c:\leo in this case) – I haven’t implemented a delete function.
![]()
Cheers,
Leo