PowerShell script exchange
Post Reply
ekisner
Expert
Posts: 202
Liked: 34 times
Joined: Jul 26, 2012 8:04 pm
Full Name: Erik Kisner
Contact:

Replication Target Datastore Re-mapping

Post by ekisner »

Hi there,

I just recently replaced my production storage array. In order to facilitate the transfer, and sleep easier at night (while I ensure that the new array performs to expectations and the like) I had my new SA replicating to my old SA, within the same fabric, for an easy failover if need be.

I'm convinced, and I've moved my old SA to my DR site. It presently has a bunch of replicas already on it, which are already re-added to the inventory of the DR site cluster. The datastores are all the same, they're just at a different cluster now (literally just turned off the old SA, drove it over, turned it on, and presented the LUNs to my DR hosts).

Rather than re-replicate the many TB of data, I'd love to just reuse the existing replicas. I have one job for each VM.

I've gotten this far, but I can see a few things missing:
- ReplicaTargetVMFolderRef: I would imagine this is the folder within which the actual VM sits - this wouldn't change, if my assumption is correct
- ReplicaTargetReourcePoolRef: This would definitely change... though I'd only need to find it once since they all sit in the same resource pool. The question is... where do I find that?
- VM Mapping: Would I need to map it? The same job will be targetting the same source and destination VMs, it's just going to be in a new location.

Code: Select all

$jobs = get-VBRJob |where-object {$_.name -like "*_R"}
$jobs | foreach-object { 
   $opt = $_.ViReplicaTargetOptions;
   $opt.ClusterName="DR cluster name";
   # $opt.ReplicaTargetVMFolderRef="????";
   $opt.ReplicaTargetResourcePoolRef="???";
   $_.SetOptions($opt);
}
ekisner
Expert
Posts: 202
Liked: 34 times
Joined: Jul 26, 2012 8:04 pm
Full Name: Erik Kisner
Contact:

Re: Replication Target Datastore Re-mapping

Post by ekisner »

Through some trial and error I've found the correct command.

What I needed to change was:
ClusterName, ClusterReference, and ReplicaTargetReourcePoolRef.

All of those I pulled straight from the vmware powershell:
Get-cluster "clustername" for the name and reference (which in vmware is just the "ID", and has a bit of preamble in front of it). get-resourcepool gave the resource id, with the same type of preamble as the cluster ID.

I have jobs running now, and I'll report back for other people's info if I run into any problems.

The command I ended up running was:

Code: Select all

$jobs = get-VBRJob | where-object {$_.name -like "specificjobcriteria"}; 
$jobs | foreach-object{$jobops = $_ | get-vbrJobOptions; $jobops.vireplicatargetoptions.ClusterName="dr cluster"; $jobops.vireplicatargetoptions.clusterreference="domain-12345"; $jobops.vireplicatargetoptions.resourcepoolref = "resgroup-12345"; $_.SetOptions($jobops);}
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Replication Target Datastore Re-mapping

Post by veremin »

Glad to hear that you’ve nailed down your issue.

Additionally, please be aware that there is no actual need to utilize PowerCLI in this case, since all of the aforesaid parameters can be obtained through VeeamPSSnapin.

ClusterName and ClusterReference:

Code: Select all

Asnp VeeamPSSnapin
$Server = Get-VBRServer -name "Name of your vCenter" | ?{$_.type -eq "VC"}
$Cluster = Find-VBRViEntity -Server $Server | ?{($_.type -eq "Cluster") -and ($_.name -eq "Cluster name")}
$Cluster.Name
$Cluster.Reference
ReplicaTargetResourcePoolRef:

Code: Select all

Asnp VeeamPSSnapin
$Server = Get-VBRServer -name "Name of your vCenter" | ?{$_.type -eq "VC"}
$ResourcePool = Find-VBRViResourcePool -Server $Server | ?{$_.name -eq "Name of your Resource Pool"}
$ResourcePool.Reference 
Hope this helps.
Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests