VM Groups in Windows Server 2016 Hyper-V
Understand how to use VM Groups
July 1, 2016
Q. What are VM Groups in Windows Server 2016?
A. VM Groups provide a new way to manage VMs by grouping VMs together that need actions performed on together. There are two types of group:
VM Collection Group - A collection of VMs
Management Collection Group - A collection of VM Collection Groups and/or other Management Collection Groups
VM Groups must be used when backing up VHD Sets (Shared VHDX) or replicating them with Hyper-V Replica as it enables the necessary orchestration between multiple VMs when performing actions on shared VHDX files. They also provide easy management of multiple VMs when using VM Collection Groups. Below is some example PowerShell to create and use the groups.
#Create new VM Collection GroupsNew-VMGroup -Name VMCGroup1 -GroupType VMCollectionTypeNew-VMGroup -Name VMCGroup2 -GroupType VMCollectionTypeNew-VMGroup -Name VMCGroup3 -GroupType VMCollectionType#Add VMs to the VM Collection GroupsAdd-VMGroupMember -VMGroup (Get-VMGroup VMCGroup1) -VM (Get-VM VM1)Add-VMGroupMember -VMGroup (Get-VMGroup VMCGroup2) -VM (Get-VM VM2)Add-VMGroupMember -VMGroup (Get-VMGroup VMCGroup2) -VM (Get-VM VM3)Add-VMGroupMember -VMGroup (Get-VMGroup VMCGroup3) -VM (Get-VM VM4)#View the membership of the groupsGet-VM | ft Name, Groups -AutoSizeGet-VMGroup -Name VMCGroup2#Perform actions on the group as if it were a VM#Enable-VMReplication -VM (Get-VMGroup VMCGroup2).VMMembers ......Start-VM -VM (Get-VMGroup VMCGroup2).VMMembers#Create VM Management Group with VMCGroup2 and VMCGroup3 in itNew-VMGroup -Name MgmtGroup1 -GroupType ManagementCollectionTypeAdd-VMGroupMember -VMGroup (Get-VMGroup MgmtGroup1) -VMGroupMember (Get-VMGroup VMCGroup2)Add-VMGroupMember -VMGroup (Get-VMGroup MgmtGroup1) -VMGroupMember (Get-VMGroup VMCGroup3)#Create VM Management Group with VMCGroup1 and MgmtGroup1 to show nestingNew-VMGroup -Name MgmtGroup2 -GroupType ManagementCollectionTypeAdd-VMGroupMember -VMGroup (Get-VMGroup MgmtGroup2) -VMGroupMember (Get-VMGroup VMCGroup1)Add-VMGroupMember -VMGroup (Get-VMGroup MgmtGroup2) -VMGroupMember (Get-VMGroup MgmtGroup1)Get-VMGroup MgmtGroup2 | Select-Object -ExpandProperty VMGroupMembers
About the Author
You May Also Like