As we Created a VM in SCVMM and this VM is placed on a cluster I want to Replicate this to an other Hyper-v Cluster just for DR.
The Script can be found here Enable Replication VM for Hyper-v Cluster
https://gallery.technet.microsoft.com/Enable-Replication-VM-for-b58bd250
First we set the Variables
# Variable
$SourceHV= "MVPTENANT001"
$ReplHV= "MVPTENANT011"
$DRVM= "MVPLOADTEST01"
The fist stepes are just checking if you already have a VM that is replicated and if there are any errors.
# Replica info
Get-Command –Module Hyper-V *repl*
# get current status
Get-VMReplication
#get repl server status settings
Get-VMReplication –ReplicaServerName $ReplHV
#get ReplicationHealth status
Get-VMReplication –ReplicationHealth Normal
Get-VMReplication –ReplicationHealth Warning
#get repl server
Get-VMReplicationServer $ReplHV
Get-VMReplication -ComputerName $SourceHV | Format-List *
(1..2) | % {get-VMReplicationServer –ComputerName MVPTENANT01$_} | Format-Table repenabled, authtype, intauth, certauth, anyserver, moninterval, monstarttime, computername
Now that we have checked that the Replication is Configured we can start creating the Replication
#Set-VMReplicationServer
enable-VMReplication –VMname $DRVM –ReplicaServerName $ReplHV –ReplicaServerPort 80 -AuthenticationType Kerberos
when Checking the Replication Settings in the cluster we can see the replication is enabled. Now we can start the replication
#start init Replication
Start-VMInitialReplication –VMName $DRVM
to see if the replication is started we do some checking
#show status
Measure-VMReplication
Get-VMReplication | Format-List *
After the initial replication it will follow the default replication schedule.
As these are just simple steps you can expand this to a bigger volume.
Happy clustering
Robert Smit