PowerShell script exchange
Post Reply
teknomage
Service Provider
Posts: 23
Liked: 2 times
Joined: Jul 21, 2010 8:55 pm
Full Name: Mike
Location: Fargo, ND
Contact:

Add-VBRViReplicaJob command question

Post by teknomage » Apr 01, 2013 9:40 pm

Is it possible to use this command to create replica jobs that will target a Cluster and not an individual host? I have it working when sending it to a host, but I have a vCenter in the target site. I'd like to have my jobs target the cluster and not a host.

Code: Select all

$server = Get-VBRServer | where {$_.Name -eq "192.168.0.1"}
$VM = Find-VBRViEntity -Name VM01
$Datastore = find-vbrvidatastore -server $server -name "nas01"

Add-VBRViReplicaJob -Server $server -Entity $VM -Suffix "_Replica" -Datastore $datastore
Case number: 00194155

veremin
Product Manager
Posts: 16778
Liked: 1405 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Add-VBRViReplicaJob command question

Post by veremin » Apr 02, 2013 11:13 am

In fact, it is not even possible in the GUI – even if you select cluster as a target for your replication job, you’ll have to explicitly specify the host to which you’re willing to replicate your VM, otherwise, it won't work.

Therefore, there is no wonder why you can’t do it by the means of Poweshell as well.

Hope this helps.
Thanks.

teknomage
Service Provider
Posts: 23
Liked: 2 times
Joined: Jul 21, 2010 8:55 pm
Full Name: Mike
Location: Fargo, ND
Contact:

Re: Add-VBRViReplicaJob command question

Post by teknomage » Apr 02, 2013 1:51 pm

When I setup jobs via the GUI I can set a remote Cluster as the replication destination:

Image

I suspect this is a limitation of the command and I will need to use other commands to modify the jobs or manually do it after the fact. I'm still awaiting official word from Veeam.

veremin
Product Manager
Posts: 16778
Liked: 1405 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Add-VBRViReplicaJob command question

Post by veremin » Apr 02, 2013 2:16 pm

As I’ve said previously, you can indeed specify the given cluster as a target for your replication job, however, in this case you won’t be able to see any cluster datastores, as they aren’t visible within the GUI, and job setting window won’t give you to proceed any further, since at least one datastore is required to be set.

See this topic for more information regarding this behaviour.

Hope this helps.
Thanks.

teknomage
Service Provider
Posts: 23
Liked: 2 times
Joined: Jul 21, 2010 8:55 pm
Full Name: Mike
Location: Fargo, ND
Contact:

Re: Add-VBRViReplicaJob command question

Post by teknomage » Apr 02, 2013 4:50 pm

I've setup multiple jobs where the remote Cluster is a destination and a shared datastore is the replication target. I would agree that if there wasn't a shared datastore, selecting a cluster would not work.

Image

I did get an email from Veeam support rep that I will not be able to enter a Cluster into the Add-VBRViReplicaJob, but that I'll have to create it with a host and then switch it to a cluster with the Set-VBRJobOptions so that's what I'm going to investigate next.

veremin
Product Manager
Posts: 16778
Liked: 1405 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Add-VBRViReplicaJob command question

Post by veremin » Apr 03, 2013 1:14 pm

I would agree that if there wasn't a shared datastore, selecting a cluster would not work.
Yep, this was my point. I apologize for not being explicitly clear.
I'll have to create it with a host and then switch it to a cluster with the Set-VBRJobOptions so that's what I'm going to investigate next.
For doing it you will probably have to change ClusterName, as well as, ClusterReference parameter with the ViReplicaTargetOptions.

In the way I see it, something like this should answer your requirements:

Code: Select all

asnp VeeamPSSnapin
$server = Get-VBRServer | where {$_.Name -eq "name of your host"}
$VM = Find-VBRViEntity -Name “name of your virtual machine”
$Datastore = find-vbrvidatastore -server $server -name "name of your datastore"
$Cluster = Find-VBRViEntity -HostsAndClusters -name "name of your cluster"
Add-VBRViReplicaJob -name "TestReplica" -Server $server -Entity $VM -Suffix "_Replica" -Datastore $datastore
$Job = Get-VBRJob | ? {$_.name -eq "TestReplica"} 
$OptionsToSet = $Job.Options
$OptionsToSet.ViReplicaTargetOptions.ClusterName = $Cluster.Name
$OptionsToSet.ViReplicaTargetOptions.ClusterReference = $Cluster.Reference
$OptionsToSet.ViReplicaTargetOptions.HostReference = ""
$Job.SetOptions($OptionsToSet) 
Hope this helps.
Thanks.

teknomage
Service Provider
Posts: 23
Liked: 2 times
Joined: Jul 21, 2010 8:55 pm
Full Name: Mike
Location: Fargo, ND
Contact:

Re: Add-VBRViReplicaJob command question

Post by teknomage » Apr 03, 2013 5:16 pm

That was actually a great help. Thank you for clarifying and providing that script. I will be using that as a basis for a more customized script.

Sidebar question: Can I post other questions about PowerShell scripts online for community assistance? It seemed like it required a ticket to be open with support before I could post my question.

tsightler
VP, Product Management
Posts: 5399
Liked: 2229 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Add-VBRViReplicaJob command question

Post by tsightler » Apr 03, 2013 6:54 pm

Posting questions that require troubleshooting (error messages, etc.) generally requires a support request, however, "how-to" questions are generally not considered support request since it's not a problem with the product so you can post here without a support request although please search first as there's already a wealth of information. Of course that's not to say that support can't help you with your scripting questions, but if you're simply asking for knowledge then that's what the community is great at.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest