Move-SCVMHost
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 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.
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 |
ParentVMHostGroup |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-PROTipID<Guid]>
Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit 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
.
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.
- Host
Notes
- This cmdlet requires a VMM host object. To obtain one, use the Get-SCVMHost cmdlet.
Examples
Example 1: Move a single host to a new parent host group
The first command gets the host named VMHost01, and then stores it in the $VMHost variable.
The second command gets the host group object named NewHostGroup, and then stores it in the $NewHG variable.
The last command moves the host stored in $VMHost to the host group stored in $NewHG.
PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost01"
PS C:\> $NewHG = Get-SCVMHostGroup -Name "NewHostGroup01"
PS C:\> Move-SCVMHost -VMHost $VMHost -ParentHostGroup $NewHG
Example 2: Move all hosts to a new parent host group
The first command gets all host objects, and then stores them in the $AllHosts array.
The second command gets the host group named NewHostGroup02, and then 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 $NewHG.
PS C:\> $AllHosts = Get-SCVMHost
PS C:\> $NewHG = Get-SCVMHostGroup -Name "NewHostGroup02"
PS C:\> $AllHosts | Move-SCVMHost -ParentHostGroup $NewHG
Example 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 then stores them in the $SpecificHosts variable.
The second command gets the host group named NewHostGroup03, and then stores it in the $NewHG variable.
The last command moves each host object stored in $SpecificHosts to the host group stored in $NewHG.
PS C:\> $SpecificHosts = Get-SCVMHost | where { $_.VMHostGroup -like "*OldGroup*" }
PS C:\> $NewHG = Get-SCVMHostGroup -Name "NewHostGroup03"
PS C:\> $SpecificHosts | Move-SCVMHost -ParentHostGroup $NewHG