Moving virtual machines to another folder, host, cluster, resource pool, or datastore

To move a virtual machine to another folder, host, cluster, resource pool, or datastore, you can use the Move-VM cmdlet. You can also use the Move-VM cmdlet to migrate a network adapter to a new port group. This cmdlet has the following syntax:

Move-VM [-AdvancedOption <AdvancedOption[]>] [[-Destination]
    <VIContainer>] [-Datastore <StorageResource>] [-DiskStorageFormat
    <VirtualDiskStorageFormat>] [-VMotionPriority <VMotionPriority>]
    [-NetworkAdapter <NetworkAdapter[]>] [-PortGroup 
    <VirtualPortGroupBase[]>] [-RunAsync] [-VM] <VirtualMachine[]>
    [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

The -VM parameter is required.

In the first example, we ...

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.