PowerShell script exchange
Post Reply
tom_nl
Influencer
Posts: 22
Liked: 3 times
Joined: Nov 02, 2018 9:13 am
Contact:

Creating backup copy job

Post by tom_nl » Sep 05, 2019 3:17 pm

Hi,

I'm trying to create a backup copy job for specific VM's.
This is what I have now:

$Server = Get-VBRServer -Type ESXi
$VM = Find-VBRViEntity -Server $Server -name "*fp5*"
Add-VBRViBackupCopyJob -DirectOperation -Name "bla" -Repository $(Get-VBRBackupRepository -Name "bla") -Entity $VM

This should work if I see the examples. But the script just hangs with no error.
If I use the "-Backup" parameter it works just fine.

What am I doing wrong?

tom_nl
Influencer
Posts: 22
Liked: 3 times
Joined: Nov 02, 2018 9:13 am
Contact:

Re: Creating backup copy job

Post by tom_nl » Sep 13, 2019 2:08 pm

Anyone?

jhoughes
Veeam Software
Posts: 114
Liked: 28 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Austin, TX
Contact:

Re: Creating backup copy job

Post by jhoughes » Sep 13, 2019 4:00 pm

Is your VM living on a standalone ESXi host, or under a vCenter server?

If you are targeting your vCenter for backing up your virtual environment, then the VM object needs to be located in the same fashion. This means that for the Server parameter of the Find-VBRViEntity cmdlet, you need to be targeting vCenter as the server type, not ESXi.

You can confirm if your commands are returning any valid results by confirming the contents of your 'Server' and 'VM' variables; I suspect that your 'VM' variable doesn't contain anything.

If you are using vCenter, try this instead (note the server type in line 1):

Code: Select all

$Server = Get-VBRServer -Type VC
$VM = Find-VBRViEntity -Server $Server -name "*fp5*"
Add-VBRViBackupCopyJob -DirectOperation -Name "bla" -Repository $(Get-VBRBackupRepository -Name "bla") -Entity $VM
Husband, Father, Solutions Architect, Geek Extraordinaire | @AustinVMUG & @ATXPowerShell leader | vExpert | Cisco Champion | Tech Field Day Delegate | VCP 4/5/6 | VCP6-NV | VMware/Cisco UCS/Powershell/VEEAM Enthusiast

tom_nl
Influencer
Posts: 22
Liked: 3 times
Joined: Nov 02, 2018 9:13 am
Contact:

Re: Creating backup copy job

Post by tom_nl » Sep 17, 2019 10:55 am 1 person likes this post

Thanks. Eventually the problem was that there was an ESXi in the Veeam configuration which wasn't accessible. This caused the script to "hang".

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests