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 will move the VM2
virtual machine to ESXi host 192.168.0.134
:
PowerCLI C:\> Get-VM -Name VM2 | Move-VM -Destination 192.168.0.134
The output...