Move-SCVMHost

Moves a virtual machine host managed by VMM from one host group to another.

Syntax

Move-SCVMHost [-VMHost] <Host> [-JobVariable <String>] [-PROTipID <Guid>] -ParentHostGroup <HostGroup>
 [-RunAsynchronously] [<CommonParameters>]

Description

The Move-SCVMHost cmdlet moves one or more virtual machine hosts managed by Virtual Machine Manager (VMM) from its current host group to a new parent host group. Before you can move a host, its new parent host group must exist.

If the host is a computer that is managed by members of a Self-Service User or Delegated Administrator user role, moving the host from one host group to another might affect the roles that have access to the host or to virtual machines on that host.

Examples

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

PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost01"
PS C:\> $NewHG = Get-SCVMHostGroup -Name "NewHostGroup01" 
PS C:\> Move-SCVMHost -VMHost $VMHost -ParentHostGroup $NewHG

The first command gets the host named VMHost01 and stores it in the $VMHost variable.

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

The last command moves the host stored in the $VMHost variable (VMHost01) to the host group stored in the $NewHG variable (NewHostGroup).

Example 2: Move all hosts to a new parent host group

PS C:\> $AllHosts = Get-SCVMHost  
PS C:\> $NewHG = Get-SCVMHostGroup -Name "NewHostGroup02"
PS C:\> $AllHosts | Move-SCVMHost -ParentHostGroup $NewHG

The first command gets all host objects and stores them in the $AllHosts array.

The second command gets the host group named NewHostGroup02 and stores it in the $NewHG variable.

The last command moves each host object in the $AllHosts array to the new parent host group stored in the $NewHG variable (NewHostGroup02).

Example 3: Move a set of hosts from one host group to a new parent host group

PS C:\> $SpecificHosts = Get-SCVMHost | where { $_.VMHostGroup -like "*OldGroup*" }
PS C:\> $NewHG = Get-SCVMHostGroup -Name "NewHostGroup03" 
PS C:\> $SpecificHosts | Move-SCVMHost -ParentHostGroup $NewHG

The first command gets all host objects whose host group contains the string "OldGroup" and stores them in the $SpecificHosts variable.

The second command gets the host group named NewHostGroup03 and stores it in the $NewHG variable.

The last command moves each host object stored in $SpecificHosts to the host group stored in the $NewHG variable (NewHostGroup03).

Parameters

-JobVariable

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

Type:String
Required:False
Position:Named
Default value:None
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
Required:False
Position:Named
Default value:None
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
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-RunAsynchronously

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

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VMHost

Specifies a virtual machine host object. VMM supports Hyper-V hosts, VMware ESX hosts, and Citrix XenServer hosts.

For more information about each type of host, see the Add-SCVMHost cmdlet.

Type:Host
Required:True
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Outputs

Host

This cmdlet returns a **Host** object.

Notes

* Requires a VMM host object, which can be retrieved by using the **Get-SCVMHost** cmdlet.