Move-SCVMHost

Applies To: System Center 2012 - Virtual Machine Manager

Move-SCVMHost

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

Syntax

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

Detailed 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

-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

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

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

-VMHost<Host>

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.

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.

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.

  • Host

Notes

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

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

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

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

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

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

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

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

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

Add-SCVMHost

Get-SCVMHost

Move-SCVMHostGroup

New-SCVMHostGroup

Read-SCVMHost

Remove-SCVMHost

Set-SCVMHost