Move-SCVMHostGroup

Moves a host group from the current location to a new location under a different host group parent.

Description

The Move-SCVMHostGroup cmdlet moves one or more host group objects, which contain virtual machine hosts managed by System Center Virtual Machine Manager (VMM), from the current location to a new location under a different host group parent. You can place host groups under the default root host group (All Hosts) or under any other host group created by an administrator. 

All hosts within a moved host group acquire a new host path relative to the root host group. Changing the structure of host groups might change which Self Service User or Delegated Administrator user roles have access to the hosts contained within the affected host groups, or to the virtual machines deployed on those hosts.

For more information about Move-SCVMHostGroup, type: "Get-Help Move-SCVMHostGroup -online".

Parameters

VMHostGroup

Required? true
Accept Pipeline Input? true (ByValue)
Position? 0
Specifies a virtual machine host group object.

ParentHostGroup

Required? true
Accept Pipeline Input? false
Position? named
Specifies the parent host group that contains one or more hosts, host groups, or host clusters.

JobGroup

Required? false
Accept Pipeline Input? false
Position? named
Specifies an identifier for a series of commands that will run as a set just before the final command that includes the same job group identifier runs. 

JobVariable

Required? false
Accept Pipeline Input? false
Position? named
Specifies that job progress is tracked and stored in the variable named by this parameter. 

PROTipID

Required? false
Accept Pipeline Input? false
Position? named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

RunAsynchronously

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the job runs asynchronously so that control returns to the command shell immediately. 
Requires a VMM host group object, which can be retrieved by using the Get-SCVMHostGroup cmdlet.

Examples

1: Move one host group to a new parent host group.
PS C:\> $OldHostGroup = Get-SCVMHostGroup -Name "OldHostGroup"
PS C:\> $NewHostGroup = Get-SCVMHostGroup -Name "NewHostGroup"
PS C:\> Move-SCVMHostGroup -VMHostGroup $OldHostGroup -ParentHostGroup $NewHostGroup
The first command gets the host group named OldHostGroup and stores the host group object in the $OldHostGroup variable. 

The second command gets the host group named NewHostGroup and stores this host group object in the $NewHostGroup variable. 

The last command moves the host group stored in the $OldHostGroup variable (OldHostGroup) to a location under its new parent host group, stored in the $NewHostGroup variable.
2: Move all host groups to a new parent host group.
PS C:\> $AllGroups = Get-SCVMHostGroup
PS C:\> $HostGroup = New-SCVMHostGroup -Name "NewHostGroup01" 
PS C:\> $AllGroups | Move-SCVMHostGroup -ParentHostGroup $HostGroup
The first command gets all host group objects and stores them in the $AllGroups array. This includes the default parent host group (All Hosts). 

The second command creates a host group object named NewHostGroup01 and stores it in the $HostGroup variable. 

The last command passes each host group object stored in the $AllGroups variable to the Move-VMHostGroup cmdlet, which moves each host group object to location stored in the $HostGroup variable, except for All Hosts because All Hosts is the default parent host group and cannot be moved.

See Also