Add Hyper-V VM's to a Backup Job

PowerShell script exchange

Add Hyper-V VM's to a Backup Job

Veeam Logoby tricksta123 » Thu Aug 30, 2012 3:53 pm

I have been trying to add Hyper-V VM's to a backup job using the following script

Code: Select all
$VMName = "VM1"
$HyperVHostNAme = "HypV1"
$JobName = "Job1"

$HyperVHost = Get-VBRServer | Where-Object{$ -eq $HyperVHostNAme }
$Job = Get-VBRJob | Where-Object{$ -eq $JobName}
$HVEntity = Find-VBRHvEntity -Name $VMName

Add-VBRJobObject -Job $Job -Server $HyperVHost -Entities $HVEntity

I get the message

Add-VBR-JobObject : Cannot bind parameter 'Entities'. Cannot convert the "Veeam.Backup.Core.Infrastructure.CHvVmItem" value of type "Veeam.Backup.Core.Infrastructure.CHvVmItem" to type "Veeam.Backup.ViSoap.Entity"

I have also tried the Add-VBRJobObject command with the -Objects variable instead of -Entities. This looks as though it works and gives no error but does not add the vm to the job.

I can only assume that this is because this cmdlet is wrappered for VMWare and not hyper-v. I cannot see a cmdlet in the guide for adding hyper-v vm's to hyper-v jobs. Does anyone know how?

Support Ref: [ID#5212550]
Posts: 2
Liked: 3 times
Joined: Wed Mar 28, 2012 8:13 am
Full Name: Trevor Baker

Re: Add Hyper-V VM's to a Backup Job

Veeam Logoby ThomasMc » Fri Aug 31, 2012 3:46 pm 1 person likes this post

While I can't test this on Hyper-V this is what you should be looking for

Code: Select all
$VMName = "dc01.vPowerCLI.local"
$ViHostName = "vc01.vPowerCLI.local"
$JobName = "VC Backup"

$ViHost = Get-VBRServer -Name $ViHostName
$Job = Get-VBRJob -Name $JobName
$JobObject = $ViHost | Find-VBRObject -Name $VMName

Add-VBRJobObject -Job $Job -Server $ViHost -Objects $JobObject
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Return to PowerShell

Who is online

Users browsing this forum: No registered users and 5 guests