The other day, I was messing around with the new Hyper-V Replica feature in my lab. I quickly came to the conclusion that although it is nice to be able to right-click on a VM in the Hyper-V MMC to initiate a failover, it would be even better if I had to a way to simply failover all Replica-enabled VM’s from one host to the other with a single action. And so I developed the attached Orchestrator runbook to do just that. About as simple as you can get. To run, you simply need to feed in which Hyper-V host you are failing over FROM and then which Hyper-V host you are failing TO. It then takes those parameters and feeds them into a relatively simple PS script which gets all of the VM’s that are enabled for HVR and for each of them, turns them off, prepares them for failover, fails them over, and finally turns them on upon the host your are failing TO. The script looks like this (and is of course embedded in the ois_export file):
…and as you can see, I do little to no error-checking or verification so the assumption is that each VM with HVR enabled has a replica on the same host you are failing TO. Also would be nice to verify that the VM is in a good state prior to trying to replicate but I simply didn’t do that but this could be easily modified.
And to make it more user-friendly, I integrated this runbook with a Service Manager Service Request so that one can simply go to the SMPortal SR page to get this kicked off:
IMO, a pretty flexible yet easy to implement way to provide automated site recovery services management…