How to use Hyper-V Replicas in Server 2012 R2 – Part 3
This is part 3 in the series of posts on Hyper-V Replicas where we will learn a few PowerShell cmdlets to use in managing your Replica environment. Here are links to part 1 and part 2.
Using PowerShell cmdlets is particularly useful if you are implementing the free Hyper-V Server 2012 R2 where graphical user interfaces are not available.
Once you have identified your Hyper-V VMs you want to target for replication and have your Replica server available, you can start the replication process with the Set-VMReplicationServer and Enable-VMReplication cmdlets.
Configure your Replica server first with Set-VMReplicationServer. You’ll need to determine the type of authentication to be used, and I recommend specifying a default storage location for your Replica VMs.
Set-VMReplicationServer –ComputerName ReplicaServer.TestDomain.com –ReplicationEnabled $true AllowedAuthenticationType Kerberos –ReplicationAllowedFromAnyServer $true –DefaultStorageLocation d:DefaultReplicaStorage
In this example, I’ve not restricted replication from any specific primary sites, and I’ve used Kerberos authentication. Valid authentication types include:
• Kerberos
• Certification
• CertificateAndKerberos
Once you have setup your Replica server, you can use Enable-VMReplication to start the replication process. In this example, I am turning on replication for all VMs on my Hyper-V server:
Enable-VMReplication * ReplicaServer.TestDomain.com 80 Kerberos
Using the wildcard character applies the cmdlet to all my VMs, and enables replication via port 80 to my Replica server named ReplicaServer.TestDomain.com.
Microsoft TechNet has a PowerShell script available for download which allows you to run a health report on your Replica environment. The script is meant to be scheduled to run daily and sends an email to specified recipients with formatted information on:
– State and health of replication VMs
– Critical, warning and info events from the event log in the previous 24 hours pertaining to Hyper-V
– Disk space usage information
You can see a list of all Replica cmdlets by running Get-Help replica.