Move-SCVMHost

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

Description

The Move-SCVMHost cmdlet moves one or more virtual machine hosts managed by System Center 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.

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

Parameters

VMHost

Required? true
Accept Pipeline Input? true (ByValue)
Position? 0
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, type: "Get-Help Add-SCVMHost -detailed". See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.

ParentHostGroup

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

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 object, which can be retrieved by using the Get-SCVMHost cmdlet.

Examples

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

See Also