Hyper-V Virtual Machine Groups

Posted on May 19, 2017 by Aidan Finn in Hyper-V, Virtualization, Windows Server 2016 with

cloud computing IT pro

In this post, I will show you how you can use virtual machine groups on Windows Server 2016 Hyper-V to manage a set of virtual machines. This includes adding support for operational actions on VHDX Sets, such as Hyper-V Replica.

 

 

What Are Virtual Machine Groups

Let’s say that you had a set of one or more virtual machines that you wanted to perform some repeatable tasks against. Maybe you need to perform an orchestrated action. An example of this would be enabling Hyper-V Replica against a pair of virtual machines that share some VHDX Sets, such as shared VHDX v2.0. We can use virtual machine groups to perform these actions.

Creating a Virtual Machine Group

All virtual machine group actions are performed using PowerShell. There is no GUI option in Hyper-V Manager. The relevant cmdlets identify virtual machines only by the object and not by the name. In larger deployments such as a private cloud, virtual machine names can be reused by different tenants or customers.

Make note, failover clustering has a different kind of group for ordering the failover of virtual machines.

We can create a new virtual machine group using the New-VMGroup cmdlet. The -type flag is instructing Hyper-V to create a virtual machine group. We also have another type called a management group, which we will look at later.

I can add a single virtual machine to this new group. This is shown below. I am using the name of the virtual machine to return the virtual machine object, which is what we added to the group.

Alternatively, I can add a pair of virtual machines.

We can query what virtual machines are in a group.

We can also query what the group memberships are for the virtual machines.

We can use this group to perform orchestrated actions. The following is an example of enabling Hyper-V Replica for virtual machines that use shared VHDX files. Notice that we substituted the name of the virtual machine being replicated with the list of members from the virtual machine group.

The above is how you can replicate virtual machines using VHDX Sets in a supported manner.

Sponsored

Virtual Machine Management Groups

It is possible to create a group of groups. Think about having a 3-tier application:

  • Web servers in a virtual machine group
  • Application servers in a second virtual machine group
  • Database servers in a third virtual machine group

You can add all three virtual machine groups into a single management group. First, we create a management group.

Then, we can add existing virtual machine groups into this management group.

Sponsored

Summary

Right now, virtual machine groups are only something that we might use with Hyper-V Replica or to replace an array in a script. Virtual machine groups live on after a script ends. I have the feeling that we are just seeing the glimpse of what virtual machine groups might offer in the future.

Sponsored

Tagged with , , , , , , , ,