31 Jan 2014

Introducing HVRSMA Toolkit

Some days ago I published a whitepaper about Service Management Automation (SMA) using Windows Azure Pack. It covers a basic guide through setup and operating SMA inside your private/hybrid cloud environment. You can get the Whitepaper here on TechNet.

Now, some days later I’m happy to publish more real life examples demonstrating the power and flexibility of SMA. In this post I’m going to introduce my brand new “Hyper-V Replica SMA Automation Toolkit”.

So first said, if you shouldn’t have a clue about Hyper-V Recovery Manager nor Hyper-V Replica, you might be wrong here. However, if you’re interested in this amazing technologies I’d recommend some good reads about Hyper-V Recovery Manager and Hyper-V Replica in general.

Hyper-V Replica



Hyper-V Recovery Manager



But back to the toolkit itself. What does it do and why did I create it?

Purpose of the HVRSMA Toolkit

  • Demonstration of SMA capabilities
  • Creation of new Hyper-V Replica relationships
  • Failover of Hyper-V Replica protected VMs
  • Planned Failover of Hyper-V Replica protected VMs
  • Cancel Failover of Hyper-V Replica protected VMs
  • Remove VM Replication
  • Orchestrate multiple VM failover process using Protection Groups

All runbooks support either single-to-single host Replica, Cluster-to-single host Replica, Single host to Cluster Replica and Cluster-to-Cluster Replica.

Why did I create a bunch of SMA Runbooks while we have Hyper-V Replica Manager ready to use on Azure?

There might be some difficulties regarding legal regulations when you are working in the financial industry, especially in the EU or even more in Switzerland. So although I think Hyper-V Recovery Manager is the way to go, sometimes it’s just impossible by the momentum and the facts given to adopt it for regulation terms, as it’s still a cloud service. And.. yes.. I’m truly aware that Hyper-V Recovery Manager doesn’t transfer any data to or from Azure, but only maintains a secure communications channel between your SCVMM and your Windows Azure subscription. So the main reason was to show the almost endless possibilities of SMA and of course hand you over an alternative to automate Hyper-V Replica within your private cloud where Hyper-V Recovery Manager is not an option right now.

How the toolkit works and which prerequisites it requires





  • SCVMM Console installed on all SMA Runbook Workers
  • WinRM Connection from all SMA Runbook Workers to all primary and secondary Hyper-V Hosts
  • SMA SCVMM Connection Object (created during the install process of the toolkit)
  • User account with administrative permission on the Hyper-V hosts
  • SMA Credential Object for the Hyper-V admin user account (created during the install process of the toolkit)


How to install the toolkit

  • Extract the ZIP file to a local folder on one of your SMA Runbook Workers
  • Open a Powershell Console and change to the extracted folder
  • Run the HVRToolkitInstall.ps1 script to import all runbooks and assets into SMA.

.\HVRToolkitInstall.ps1 –SMAWebServiceEndpoint https://sma.demonet.ch

The installation process will ask you for some parameters such as the FQDN of SCVMM, a username and password for the SCVMM connection

as well as username and password for the SMA credential object used to connect to Hyper-V Hosts via WinRM


How to use it

After running the installation script, you should have the following new SMA Runbooks / Assets imported:

Name Type Description
HVR-Enable-VMReplication Runbook Create a new Replica relationship for a single VM
HVR-Remove-VMReplication Runbook Remove a Replica relationship for a single VM and optionally delete the replica
HVR-Start-VMPlannedFailover Runbook Initiate a planned failover for a single VM (including reversing the replication direction)
HVR-Start-VMFailover Runbook Initiate a failover for a single VM
HVR-Cancel-VMFailover Runbook Cancel a previous failover of a single VM
HVR-Process-VMFailoverPlan Runbook Initiate a failover for multiple VMs where the VMM CustomProperty “ProtectionGroup” has been set. Respect the priority high,medium,low by initiating the failover in parallel for high tagged VMs first.
SCVMM VirtualMachineManager Connection Object A SMA Connection object including the SCVMM Hostname, Username and Password to connect
HVHostManagement Credential Object A SMA Credential object including the Username and Password to connect to Hyper-V Hosts using WinRM


Some Examples

Enabling a new Replica Relationship

Start the runbook

Fill out the Runbook Parameters

Viewing the Job Output


Process a regular or planned Failover for a Group of VMs

Configure the primary VMs within SCVMM by setting the ProtectionGroup and FailoverPriority Custom Properties. Group your VMs for the failover priority by either setting a value of High | Medium | Low. The Protection Group Name is used to failover all VMs matching the same Value.

Kick off the Runbook

Set the Parameters

View the Job Status


Current Limitations / Known Issues

  • Works only with single SCVMM deployment, dual SCVMM deployment support will be included in a future version
  • Removing a replication where the Replica Config is in an inconsistent state will fail
  • Sometimes, deleting the Replica VM may fail if HVR-Remove-VMReplication is invoked with RemoveReplica switch set to YES
  • Protection Groups support the following naming: High | Medium | Low . Other names are currently not supported.
  • Most of the runbooks do not properly support “Resuming” if stopped because of a raised exception
  • The Toolkit does not yet support tertiary replication setups and configurations

Where to get the tookit?

Download the Toolkit here from TechNet

Feedback, Bug Reporting and Q+A

Please use the Q+A section on TechNet to get in touch and to report bugs or request features.