Management Collection Group A collection of VM Collection Groups and/or
other Management Collection Groups
In addition to being required for VHD Set operations, VM Groups also provide easy
management of multiple VMs when using VM Collection Groups. Some example
PowerShell follows for creating and using the groups. Notice that for some actions, the
VM Group is enumerated for its members that are then used for actions.
#Create new VM Collection Groups
New-VMGroup -Name VMCGroup1 -GroupType VMCollectionType
New-VMGroup -Name VMCGroup2 -GroupType VMCollectionType
New-VMGroup -Name VMCGroup3 -GroupType VMCollectionType
#Add VMs to the VM Collection Groups
Add-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 groups
Get-VM | ft Name, Groups -AutoSize
Get-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 it
New-VMGroup -Name MgmtGroup1 -GroupType ManagementCollectionType
Add-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 nesting
New-VMGroup -Name MgmtGroup2 -GroupType ManagementCollectionType
Add-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
PowerShell Direct
PowerShell provides a powerful mechanism to locally manage an OS instance or
remotely manage it using WinRM. At times, however, a networking issue may prevent
remote PowerShell management in a way similar to how a networking issue blocks
RDP access.
PowerShell Direct enables communication to a VM from its host via PowerShell, even
when networking or firewall configurations would typically block communication.
This communication via PowerShell Direct is enabled through the secure VMBus