SCVMM, Hyper-V Replica, UI and PowerShell
Before I get started on this – I do want to be upfront about the context for this post. In my house I am currently running Hyper-V Server 2012 R2 with Hyper-V Replica enabled. I am then managing my environment with System Center Virtual Machine Manager 2012 R2.
I am not (yet) using Hyper-V Recovery Manager (https://www.windowsazure.com/en-us/services/recovery-manager/).
Now, if you are unfamiliar with the story here. Hyper-V Recovery Manager is our official solution for managing Hyper-V Replica with System Center. This means that I am not doing things “by the book” right now (why? Because there are only so many hours in the day and this is actually all stuff that I do in my spare time!).
So what is the experience if you are using Hyper-V Replica with System Center Virtual Machine Manager 2012 R2 without Hyper-V Recovery Manager? In short, not bad.
SCVMM has no support for configuring or orchestrating Hyper-V Replica directly. I am currently using Hyper-V manager to do that. It does, however, detect that Hyper-V Replica has been configured and allows me to view the replication health in the SCVMM UI. There is one annoyance I have found with this configuration:
This is a screenshot of my SCVMM console. As you can see it has all of my virtual machines and all of their replicas. I do not have it displayed here – but I can also add a column that shows the replication health. Unfortunately, there is no way for me to tell which virtual machines are the primary virtual machines and which are the replicas. Annoying.
For the most part I can figure this out intuitively (the primary virtual machine is the one that is running!) But if I have a virtual machine that is turned off (like my TS Gateway in the above screenshot) I have not figured out how to tell the primary from the replica using the SCVMM UI.
PowerShell is much better though.
Here it is very easy to tell the virtual machines apart. Let’s say I wanted to get the primary TS Gateway virtual machine – I would use this command:
$VM = Get-SCVirtualMachine "TS Gateway” | ?{$_.IsPrimaryVM}
Similarly, to get the replica virtual machine I would run:
$VM = Get-SCVirtualMachine "TS Gateway” | ?{$_.IsRecoveryVM}
Nice and simple.
Hopefully I will find the time to setup Hyper-V Recovery Manager soon (after updating my VPN server, setting a new blog site, getting a new mail server up and running, getting the Windows Azure pack loaded… This may take a while!)
Cheers,
Ben
Comments
Anonymous
February 23, 2014
Hi, i installed hyper v 2012 (bare metal installation) and tried to access from windows server 2008 r2 using powershell snapin. Any one have the idea about powershell hyper v snapin? Could you please tell me which is the powershell snapin? i tried to add 'Microsoft.SystemCenter.VirtualMachineManager'. but i got this error: "The Windows PowerShell snap-in 'Microsoft.SystemCenter.VirtualMachineManager' is not installed on this machine." how can i add ps snapin for hyper v? its very urgent thank you SumithAnonymous
February 27, 2014
To use SC VMM powershell from your 2008R2 server you will need to install the SCVMM console in it. You could then launch the PowerShell prompt with the correct module loaded for SCVMM Regards, PaulAnonymous
June 06, 2014
One note on telling the difference between the primary and replica. The icons on the left column are different. The 2 server icon for the replica, and the single server icon for the primary.Anonymous
January 31, 2016
To identify, my method: I rename the replica. Appended (replica).