PowerShell script exchange
Post Reply
Simpleacc
Influencer
Posts: 12
Liked: never
Joined: Nov 13, 2017 10:02 am
Full Name: Javier
Contact:

Set-VBRViReplicaJob replacement

Post by Simpleacc »

Hello,

I am trying to do a script to seed mapping VMs from Replicas job: (followed this documentation exaple3 https://helpcenter.veeam.com/docs/backu ... tml?ver=95)

Code: Select all

$job = Get-VBRJob -Name "replica-test"
$originalvm = Find-VBRViEntity -Server "orghost" -Name "testVM1"
$replicavm = Find-VBRViEntity -Server "dsthost" -Name "testVM1_replica"
Set-VBRViReplicaJob -Job $job -EnableVMMapping -OriginalVM $originalvm -ReplicaVM $replicavm
If I run this script, it works fantastic, the problem is when I want to add more than 1 mapping, like this:

Code: Select all

$job = Get-VBRJob -Name "replica-test"

$originalvm = Find-VBRViEntity -Server "orghost" -Name "testVM1"
$replicavm = Find-VBRViEntity -Server "dsthost" -Name "testVM1_replica"
Set-VBRViReplicaJob -Job $job -EnableVMMapping -OriginalVM $originalvm -ReplicaVM $replicavm

$originalvm = Find-VBRViEntity -Server "orghost" -Name "testVM2"
$replicavm = Find-VBRViEntity -Server "dsthost" -Name "testVM2_replica"
Set-VBRViReplicaJob -Job $job -EnableVMMapping -OriginalVM $originalvm -ReplicaVM $replicavm

$originalvm = Find-VBRViEntity -Server "orghost" -Name "testVM3"
$replicavm = Find-VBRViEntity -Server "dsthost" -Name "testVM3_replica"
Set-VBRViReplicaJob -Job $job -EnableVMMapping -OriginalVM $originalvm -ReplicaVM $replicavm
If I run this one, the script result looks fine, but if I check the replica job from Veeam interface, it shows testVM1 and testVM2 without mapping and testVM3 with mapping.
If I try it again and stop the scrip when it is working on the second VM, powershell shows me the testVM1 and testVM3 without mapping and testVM2 mapped.

Is it possible configure the mapping for all these vm at same time? If we do it via Veeam Replication & Backup with the GUI we can do it, but with command line... it does not work...

Someone had the same problem?

Best regards,
Simpelacc
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Set-VBRViReplicaJob replacement

Post by veremin »

Both -OriginalVM and -ReplicaVM parameters accept arrays, so, try to pass arrays consisting of VMs (preserving the required order), instead of single entities. Thanks.
Simpleacc
Influencer
Posts: 12
Liked: never
Joined: Nov 13, 2017 10:02 am
Full Name: Javier
Contact:

Re: Set-VBRViReplicaJob replacement

Post by Simpleacc »

Fantastic! It worked fine :D
Now I can modify all existing VMs from a job at same time.

Thanks so much!
You can close this topic if you want
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Set-VBRViReplicaJob replacement

Post by veremin »

You're welcome. Feel free to contact us, should other help be needed.
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests