Moving a virtual machine 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. This cmdlet has the following syntax:

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

In the first example, we will move the VM2 virtual machine to host 192.168.0.133:

PowerCLI C:\> Get-VM -Name VM2 | Move-VM -Destination 192.168.0.133

The output to the preceding command is as follows:

Name                 PowerState Num CPUs MemoryGB
---- ---------- ...

Get Learning PowerCLI 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.