Move-SCVMHostGroup
Moves a host group from the current location to a new location under a different host group parent.
Syntax
Move-SCVMHostGroup
[-VMHostGroup] <HostGroup>
[-JobGroup <Guid>]
-ParentHostGroup <HostGroup>
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[<CommonParameters>]
Description
The Move-SCVMHostGroup cmdlet moves one or more host group objects, which contain virtual machine hosts managed by 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.
Examples
Example 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.
Example 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.
Parameters
-JobGroup
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.
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-JobVariable
Specifies that job progress is tracked and stored in the variable named by this parameter.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ParentHostGroup
Specifies the parent host group that contains one or more hosts, host groups, or host clusters.
Type: | HostGroup |
Aliases: | ParentVMHostGroup |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PROTipID
Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RunAsynchronously
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VMHostGroup
Specifies a virtual machine host group object.
Type: | HostGroup |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Outputs
HostGroup
This cmdlet returns a HostGroup object.
Notes
- Requires a VMM host group object, which can be retrieved by using the Get-SCVMHostGroup cmdlet.