Moves virtual machines to another location.


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

Related Commands


Detailed Description

Moves a virtual machine to the location that is specified by the -Destination or the -Datastore parameters. The destination must be a folder, host, cluster, or a resource pool. Moving a virtual machine in a cluster is only possible if the virtual machine is in a resource pool in that cluster. If the virtual machine is outside the cluster, you need to specify a virtual machine host in that cluster as destination. When moving virtual machines that are powered on, VMotion is used. To specify a server different from the default one, use the -Server parameter.


NameDescriptionRequired?Pipeline InputDefault Value
DestinationSpecify a folder, host, cluster, or a resource pool where you want to move the virtual machines. If a datacenter is specified for the -Destination parameter, the virtual machines are moved to the datacenter's "vmFolder" folder. The "vmFolder" is a system folder and is guaranteed to exist.
Passing values to this parameter through a pipeline is deprecated and will be disabled in a future release.
falsetrue (ByValue)
DatastoreSpecify the datastore where you want to move the virtual machines.falsefalse
RunAsyncIndicate that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the -RunAsync parameter run " help About_RunAsync" in the vSphere PowerCLI console.falsefalse
VMSpecify the virtual machines you want to move to another location.truetrue (ByValue)
ServerSpecify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
WhatIfIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse
ConfirmIndicate that the cmdlet asks for confirmation before running.falsefalse

Input Type

Return Type




--------------  Example 1 --------------

C:\PS>Get-VM -Name XP_VC_Tech | Move-VM -Destination (Get-VMHost

Moves the virtual machine named XP_VC_Tech from its current location to the host
 on IP address

Name                 PowerState Num CPUs Memory (MB)
----                 ---------- -------- -----------
XP_VC_Tech               PoweredOff 1        256

--------------  Example 2 --------------

C:\PS>Move-VM -VM (Get-VM -Name XP_VC_Tech) -Destination (Get-Folder -Name Marke

Moves the virtual machine to a folder called Marketing-VM. Note that you are abl
e to move virtual machines only to folders containing virtual machines (the 'blu
e' folders in the vSphere Client).

Name                 PowerState Num CPUs Memory (MB)
----                 ---------- -------- -----------
XP_VC_Tech               PoweredOff 1        256

--------------  Example 3 --------------

C:\PS>Move-VM -VM (Get-VM -Name XP_VC_Tech) -Destination (Get-ResourcePool -Name
 "VM Resource Pool")

Moves the virtual machine to the VM Resource Pool resourcepool. The ESX host doe
s not change.

Name                 PowerState Num CPUs Memory (MB)
----                 ---------- -------- -----------
XP_VC_Tech               PoweredOff 1        256

Copyright © 1998 - 2009 VMware, Inc. All rights reserved.