Add vCloud vApp/VM to the existing backup job

PowerShell script exchange

Add vCloud vApp/VM to the existing backup job

Veeam Logoby amiasoedov » Wed Dec 30, 2015 7:30 am

Which cmdlets should I use to add vCloud vApp/VM to the existing backup job? I struggled to do this with Add-VBRJobObject / Add-VBRViJobObject.
amiasoedov
Novice
 
Posts: 3
Liked: 1 time
Joined: Wed Dec 30, 2015 7:27 am
Full Name: Alexey Miasoedov

Re: Add vCloud vApp/VM to the existing backup job

Veeam Logoby v.Eremin » Wed Dec 30, 2015 11:39 am

What particular issue you came across while trying to add vCD entity to a job via Add-VBRViJobObject? Also, is it a vCD backup job?
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Add vCloud vApp/VM to the existing backup job

Veeam Logoby amiasoedov » Wed Dec 30, 2015 12:55 pm

You cannot pass an item of type CVcdVmItem (returned by Find-VBRvCloudEntity) to Add-VBRViJobObject cmdlet (requires IViItem).

Code: Select all
public class CVcdVmItem : IVcdItem, IVmItem, IItem, IEquatable<CVcdVmItem>
public interface IViItem : IItem


Here is an example:

Code: Select all
$cloud_vm = Find-VBRvCloudEntity -Name 'CARROLLWEB01' -Server $vCloud | ? Type -eq Vm
$test_job = Get-VBRJob -Name TestBackupJob
$test_job.BackupPlatform
EVcd

Add-VBRViJobObject -Job $test_job -Entities $cloud_vm
Add-VBRViJobObject : Cannot bind parameter 'Entities'. Cannot convert the "Veeam.Backup.Core.Infrastructure.CVcdVmItem" value of type
"Veeam.Backup.Core.Infrastructure.CVcdVmItem" to type "Veeam.Backup.Core.Infrastructure.IViItem".
amiasoedov
Novice
 
Posts: 3
Liked: 1 time
Joined: Wed Dec 30, 2015 7:27 am
Full Name: Alexey Miasoedov

Re: Add vCloud vApp/VM to the existing backup job

Veeam Logoby tsightler » Wed Dec 30, 2015 4:05 pm

I don't think there's a Powershell cmdlet to do this, although perhaps someone will correct me. However, I've successfully used this workaround:

Code: Select all
$cloud_vm = Find-VBRvCloudEntity -Name 'CARROLLWEB01' -Server $vCloud | ? Type -eq Vm
$test_job = Get-VBRJob -Name TestBackupJob
$added = $failed = $null
[Veeam.Backup.Core.Infrastructure.CJobItemsHelper]::TryAddItemsToJob($test_job, $cloud_vm, [ref] $added, [ref] $failed)
tsightler
Veeam Software
 
Posts: 4768
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Add vCloud vApp/VM to the existing backup job

Veeam Logoby v.Eremin » Wed Dec 30, 2015 4:09 pm

I was about to write the same. Current vCD commandlets allow to add objects only during job creation. In order to add objects to existing job you have to load assembly and work with the mentioned methods. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Add vCloud vApp/VM to the existing backup job

Veeam Logoby amiasoedov » Thu Dec 31, 2015 11:43 am 1 person likes this post

Thank you guys! This works perfectly.
amiasoedov
Novice
 
Posts: 3
Liked: 1 time
Joined: Wed Dec 30, 2015 7:27 am
Full Name: Alexey Miasoedov

Re: Add vCloud vApp/VM to the existing backup job

Veeam Logoby v.Eremin » Thu Jan 07, 2016 8:32 am

You're welcome. By the way, thank you for raising that again, we'll see what can be done in this regard in future.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 7 guests