PowerShell Virtual Machine Replication Using Hyper-V Replica #cloud #scvmm #Microsoft   Leave a comment

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

image

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

 

 

image

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

image

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 *

image

After the initial replication it will follow the default replication schedule.

image

 

As these are just simple steps you can expand this to a bigger volume.

Happy clustering

Robert Smit

@clusterMVP

https://robertsmit.wordpress.com

Posted April 17, 2015 by Robert Smit [MVP] in Azure Pack, Hyper-V

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

  • Twitter

  • %d bloggers like this: