Moving hosts to clusters

You can use the Move-VMHost cmdlet to move a host to a cluster. The host has to already be added to your vSphere inventory. If it isn't, you can use the Add-VMHost cmdlet to add the host to your inventory, as shown in Chapter 4, Managing vSphere Hosts with PowerCLI . The host also has to be in a maintenance mode or you will get the error message: The operation is not allowed in the current state.

The syntax of the Move-VMHost cmdlet is as follows:

Move-VMHost [-VMHost] <VMHost[]> [-Destination] <VIContainer>
    [-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm]
    [<CommonParameters>]

The -VMHost and -Destination parameters are required.

You can also use the Move-VMhost cmdlet to move a host to another VIContainer such as ...

Get Learning PowerCLI - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.