Creating VBM from scratch

Excellent script posted by “tsightler” on the Veeam forums regarding creating a VBM file from scratch; http://forums.veeam.com/powershell-f26/creating-vbm-from-scratch-t20568.html

Indeed, having a VBM file is not required to be able to restore files or VMs, as a matter of fact, the script referenced above, as well as the one that I post below, use this fact to create VBM files from scratch. For my simple script below you use the Veeam GUI to import the VBK, set the variables in the script (backup name) and the run it. It uses an internal function call to create the VBM XML data, make a minor modification to the JobName and then writes it the data out to the VBM. If you have only the VBK file you must use the “Import” button to browse and locate the VBK file and have it imported into Veeam, but it should work with no problem.

Creating a VBM can sometimes be useful. One common use for me is to create a seed for backup copy jobs from a “normal” backup chain. Normally a backup copy job must be seeded from a single restore points/VBK file which prevents you from using an existing backup chain for a seed since these almost always have multiple chains, however, using this script you can grab just the most recent VBK from an existing backup chain, import it, run the script to create a VBM, and then combine them to use as a seed for a BCJ.

Anyway, just in case it is needed here is the script that I use to create VBM files from scratch. It’s basically a modified version of the script referenced above, but much simpler as I removed the GUI and the automatic import of the VBK, you can just use the Veeam GUI for those steps. The script creates the VBM file on the current users Desktop, but that’s easy to change to any path. After running the script you can place the VBK and the newly created VBM file in any repository. Since it now has an appropriate VBM file a simple rescan of the repo will cause it to show up in the GUI and it can now be used for mapping backup or backup copy jobs.

Copy the below into a Veeam powershell cli

asnp “VeeamPSSnapIn” -ErrorAction SilentlyContinue

$BackupName = “”
$Backup = Get-VBRBackup -Name ($BackupName + “_imported”)
$VBMFile = “$env:UserProfileDesktop” + “$BackupName” + “.vbm”

$Data = [Veeam.Backup.Core.CBackupMetaGenerator]::GenerateMeta($Backup)
$Data.Serialize() | Out-File $VBMFile
$xml = New-Object XML
$xml.Load($VBMFile)
$xml.BackupMeta.JobName = $BackupName
$xml.Save($VBMFile)
Remove-VBRBackup -Backup $Backup -Confirm:$false

Leave a Reply

Your e-mail address will not be published. Required fields are marked *