Partager via


Move-SCVMHostGroup

Move-SCVMHostGroup

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

Syntax

Parameter Set: Default
Move-SCVMHostGroup [-VMHostGroup] <HostGroup> -ParentHostGroup <HostGroup> [-JobGroup <Guid]> ] [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [ <CommonParameters>]

Detailed 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.

Parameters

-JobGroup<Guid]>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

Specifies that job progress is tracked and stored in the variable named by this parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ParentHostGroup<HostGroup>

Specifies the parent host group that contains one or more hosts, host groups, or host clusters.

Aliases

ParentVMHostGroup

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid]>

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMHostGroup<HostGroup>

Specifies a virtual machine host group object.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • HostGroup

Notes

  • Requires a VMM host group object, which can be retrieved by using the Get-SCVMHostGroup cmdlet.

Examples

Example 1: Move one host group to a new parent host group

The first command gets the host group named OldHostGroup, and then stores the host group object in the $OldHostGroup variable.

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

The last command moves the host group stored in the $OldHostGroup variable to a location under its new parent host group, stored in the $NewHostGroup variable.

PS C:\> $OldHostGroup = Get-SCVMHostGroup -Name "OldHostGroup"
PS C:\> $NewHostGroup = Get-SCVMHostGroup -Name "NewHostGroup"
PS C:\> Move-SCVMHostGroup -VMHostGroup $OldHostGroup -ParentHostGroup $NewHostGroup

Example Example 2: Move all host groups to a new parent host group.

The first command gets all host group objects, and then 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 then 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.

PS C:\> $AllGroups = Get-SCVMHostGroup
PS C:\> $HostGroup = New-SCVMHostGroup -Name "NewHostGroup01"
PS C:\> $AllGroups | Move-SCVMHostGroup -ParentHostGroup $HostGroup

Get-SCVMHostGroup

New-SCVMHostGroup

Remove-SCVMHostGroup

Set-SCVMHostGroup