Add Hyper-V VM to existing backup job

PowerShell script exchange

Add Hyper-V VM to existing backup job

Veeam Logoby Dziugas » Tue Nov 27, 2012 9:41 am

Hi,

Is it possible to add hyper-v VM to a existing backup job via PowerShell?
I found many examples how to add VMWare VM to existing job but I can't find any example how to add hyper-v VM to backup job. Is it supported?

BR,
Dziugas
Dziugas
Novice
 
Posts: 4
Liked: never
Joined: Tue Nov 27, 2012 8:56 am
Full Name: Dziugas

Re: Add Hyper-V VM to existing backup job

Veeam Logoby v.Eremin » Tue Nov 27, 2012 9:59 am

Hi.

Can I ask you to provide a little bit more information regarding your task.
I'm wondering whether you're willing to add Hyper-V VM to the job within which VMware VMs are being backuped? Or just to add another Hyper-V VM to Hyper-V backup job?

Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Add Hyper-V VM to existing backup job

Veeam Logoby Dziugas » Tue Nov 27, 2012 10:03 am

Hi,

I want to add additional Hyper-V VM to a existing Hyper-V backup job.

BR,
Dziugas
Dziugas
Novice
 
Posts: 4
Liked: never
Joined: Tue Nov 27, 2012 8:56 am
Full Name: Dziugas

Re: Add Hyper-V VM to existing backup job

Veeam Logoby v.Eremin » Tue Nov 27, 2012 11:30 am

As you may have already understood, the reason for my question was the fact that you can’t actually mix up Hyper-V and VMware VMs within one job.

As for your task, I believe, that something like this should work fine, though I didn’t have a chance to test it.

Code: Select all
asnp VeeamPSSnapin
$JobName = Get-VbrJob |? {$_.Name -eq "Name of your Job"}
$HVServer = Get-VbrServer |? {$_.Name -eq "Name of your Hyper-V Server"}
$VMtoAdd = $HVServer | Find-VBRObject |? {$_.Name -eq "Name of VM you want to add"}
Add-VBRJobObject -job $JobName -server $HVServer -Objects $VMtoAdd


Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Add Hyper-V VM to existing backup job

Veeam Logoby Dziugas » Tue Nov 27, 2012 1:17 pm

Hi,

The output of commands looks like that:

Code: Select all
PS C:\Users\Dziugas> $JobName = Get-VbrJob |? {$_.Name -eq "LAB-v2"}
PS C:\Users\Dziugas> $HVServer = Get-VbrServer |? {$_.Name -eq  "CLUSTER.lab.local"}
PS C:\Users\Dziugas> $VMtoAdd = $HVServer | Find-VBRObject |? {$_.Name -eq "T001-229"}
Find-VBRObject : Failed to login to "SCVMM.lab.local" by SOAP, port 443, user "", proxy srv: port:0
At line:1 char:38
+ $VMtoAdd = $HVServer | Find-VBRObject <<<<  |? {$_.Name -eq "T001-229"}
    + CategoryInfo          : InvalidOperation: (Veeam.Backup.Po...d.FindVBRObject:FindVBRObject) [Find-VBRObject], Ex
   ception
    + FullyQualifiedErrorId : Backup,Veeam.Backup.PowerShell.Command.FindVBRObject


Veeam tries to connect to Virtual machine manager like to the ESX(i) host, via TCP 443 port.

In Veeam Backup & Replication PowerShell 6.5 reference guide I found only ESX(i) host mentioned as a "-server" parameter for Find-VBRObject command
This cmdlet returns a list of all VMs and VM containers on the specified ESX(i) host.

Is Find-VBRObject suitable for getting VM objects from Hyper-V servers?

BR,
Dziugas
Dziugas
Novice
 
Posts: 4
Liked: never
Joined: Tue Nov 27, 2012 8:56 am
Full Name: Dziugas

Re: Add Hyper-V VM to existing backup job

Veeam Logoby v.Eremin » Wed Nov 28, 2012 8:51 am

If such error occurred in vCenter case, I would say that it must have been caused by lack of memory available to PS-script and would definitely implement something like this:

Code: Select all
set-item wsman:localhost\Shell\MaxMemoryPerShellMB 512


However, since it’s completely opposite situation and since I’ve tried this script in my environment and ended up with the same or relatively the same error, it’s more likely to be typical limitation of support.

In fact, not only did I try “Find-VBRObject” method to address the issue but also I tested “Find-HvEntity”, still without any success.

So, on the surface it seems to be a restriction, but someone might correct me and provide a solution, that I’ve overlooked.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Add Hyper-V VM to existing backup job

Veeam Logoby Dziugas » Wed Nov 28, 2012 9:57 am

Hi,

Find-VBRHvEntity works, but I can't use the object neither as "-object" nor as "-entity" in a command Add-VBRJobObject.

BR,
Dziugas
Dziugas
Novice
 
Posts: 4
Liked: never
Joined: Tue Nov 27, 2012 8:56 am
Full Name: Dziugas

Re: Add Hyper-V VM to existing backup job

Veeam Logoby v.Eremin » Wed Nov 28, 2012 10:07 am

Yep, that's exactly what I was talking about. By the means of "Find-HvEntity" you're able to receive information regarding VM residing on Hyper-V host, meanwhile you aren't able to do something useful with it, e.g. to provide this data either as "-object" or "-entity" parameter.

If I have time, I'll try to look at this issue again, more thoughtfully this time, and will report if some workaround comes into my mind.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Add Hyper-V VM to existing backup job

Veeam Logoby BGilbert » Fri Dec 21, 2012 9:28 pm

I know adding a Hyper-V VM to an existing Hyper-V job wasn't supported in version 6.0. I was hoping that got fixed in version 6.5.
BGilbert
Influencer
 
Posts: 11
Liked: 3 times
Joined: Wed Jun 20, 2012 10:01 pm
Full Name: Brian Gilbert

Re: Add Hyper-V VM to existing backup job

Veeam Logoby Sethbartlett » Thu Jan 03, 2013 10:16 pm

@Dziugas I believe I sent BGilbert an unsupported script to do this, but there is not a cmdlet for it currently.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: Add Hyper-V VM to existing backup job

Veeam Logoby BGilbert » Tue Jan 08, 2013 4:45 pm

@Seth, the script broke when I upgraded to 6.5.
BGilbert
Influencer
 
Posts: 11
Liked: 3 times
Joined: Wed Jun 20, 2012 10:01 pm
Full Name: Brian Gilbert


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 5 guests