[PowerShell] Scripted SureBackup Jobs in v10 and later

  • 21 December 2020

Userlevel 7
Badge +5
  • Veeam Legend, Veeam Vanguard

Some time ago I posted a new feature in v10 PowerShell Plugin. With it it is possible to set - next to others - higher timeouts for boot and application initialization for SureBackup application groups. Here I want to show how to implement:

Set your preferred option, see example here:

$Startup = New-VBRSureBackupStartupOptions -AllocatedMemory 100 -EnableVMHeartbeatCheck:$true -EnableVMPingCheck:$false -MaximumBootTime 1000 -ApplicationInitializationTimeout 1000

Select the job(s) you want add VM to SureBackup from. Sure this can be in one line, but this is to show each step:

$VBRJob = Get-VBRJob -Name "Backup Job"
$VBRVMs = Get-VBRJobObject -Job $VBRJob

Now, build an array of backup-VM with the correct object-type (CObjectInJob):

$VSBVMs = @()
$VBRVMs | foreach {$VSBVMs += New-VBRSureBackupVM -VM $_ -StartupOptions $Startup}

Note: Backup job must have run at least once. Otherwise you the the error:

New-VBRSureBackupVM : Object reference not set to an instance of an object.


Finally, create your application group:

Add-VBRViApplicationGroup -Name "Autmated_group" -VM $VSBVMs 


But there is a huge BUT: currently there seems to be no way to use this, when VMs are selected by vSphere tags! I ask already in the R&D Forum.

But the good news are: This works in PowerShell modules for v11. Here we can use New-VBRSureBackupVM to add vSphere tags as well:

$AllVMs = New-VBRSureBackupVM -Tag $VBRVMs -StartupOptions $Startup

[Update] Parameter -Tag does not seem to have made it into the final version. Asked for the reason in R&D Forum.

Note: In this code-line, $VBRVMs contains one tag, chosen in backup job. If there are more, you have to loop through them.


Userlevel 7
Badge +4

Wow, fascinating feature.

I like the script controlled jobs very much.

Userlevel 7
Badge +5

Just updated the post: “-Tag” does not seem to have made it into the final version. This is very disappointing. So it is still not possible to use cmdlet New-VBRSureBackupVM (since v10) in combination with tag-based backup jobs. :angry: