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

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

Author: Robert Smit [MVP]

Robert Smit is Senior Technical Evangelist and is a current Microsoft MVP in Clustering as of 2009. Robert has over 20 years experience in IT with experience in the educational, health-care and finance industries. Robert’s past IT experience in the trenches of IT gives him the knowledge and insight that allows him to communicate effectively with IT professionals who are trying to address real concerns around business continuity, disaster recovery and regulatory compliance issues. Robert holds the following certifications: MCT - Microsoft Certified Trainer, MCTS - Windows Server Virtualization, MCSE, MCSA and MCPS. He is an active participant in the Microsoft newsgroup community and is currently focused on Hyper-V, Failover Clustering, SQL Server, Azure and all things related to Cloud Computing and Infrastructure Optimalization. Follow Robert on Twitter @ClusterMVP Or follow his blog https://robertsmit.wordpress.com Linkedin Profile Http://nl.linkedin.com/in/robertsmit Robert is also capable of transferring his knowledge to others which is a rare feature in the field of IT. He makes a point of not only solving issues but also of giving on the job training of his colleagues. A customer says " Robert has been a big influence on our technical staff and I have to come to know him as a brilliant specialist concerning Microsoft Products. He was Capable with his in-depth knowledge of Microsoft products to troubleshoot problems and develop our infrastructure to a higher level. I would certainly hire him again in the future. " Details of the Recommendation: "I have been coordinating with Robert implementing a very complex system. Although he was primarily a Microsoft infrastructure specialist; he was able to understand and debug .Net based complext Windows applications and websites. His input to improve performance of applications proved very helpful for the success of our project

Leave a Reply

Please log in using one of these methods to post your comment:

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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: