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: 14012
Liked: 1051 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 1 person likes this post

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: 4923
Liked: 1850 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: 14012
Liked: 1051 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 1 person likes this post

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: 14012
Liked: 1051 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 Reittier » Fri Sep 01, 2017 1:20 pm

v.Eremin wrote:You're welcome. By the way, thank you for raising that again, we'll see what can be done in this regard in future.

is this done yet?
Reittier
Lurker
 
Posts: 2
Liked: never
Joined: Fri Sep 01, 2017 1:15 pm
Full Name: Sebastian Reitter

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

Veeam Logoby Reittier » Fri Sep 01, 2017 1:22 pm

Thanks, this helped me!
Did yozu address this in the mean time?
Reittier
Lurker
 
Posts: 2
Liked: never
Joined: Fri Sep 01, 2017 1:15 pm
Full Name: Sebastian Reitter

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

Veeam Logoby v.Eremin » Fri Sep 01, 2017 2:43 pm 1 person likes this post

Nope, however, the provided workaround that includes loading assembly should be still a way to go. Thanks.
v.Eremin
Veeam Software
 
Posts: 14012
Liked: 1051 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 twkonefal » Fri Dec 08, 2017 2:29 pm

In order to back up a vApp I have code like this, but it is PAINFULLY slow (nearly a minute per query). I'm unable to change the vcdsystem type to anything else and still get a result for the find-vbrvcloudentity call. Using find-vbrvientity doesn't work for vApps.
Code: Select all
$s = get-vbrserver -type vcdsystem
$vcloudvApp = find-vbrvcloudentity -name 'Entity' -server $s -vApp
...

Is there a faster way to get this object so I can feed it to the TryAddItemsToJob call?
Code: Select all
[Veeam.Backup.Core.Infrastructure.CJobItemsHelper]::TryAddItemsToJob($test_job, $cloud_vm, [ref] $added, [ref] $failed)
twkonefal
Lurker
 
Posts: 1
Liked: never
Joined: Fri Dec 08, 2017 1:48 pm
Full Name: T. Konefal


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest