Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Move-VM

Move-VM

Moves a virtual machine to a new Hyper-V host.

Syntax

Parameter Set: CompatibilityReport
Move-VM [-CompatibilityReport] <VMCompatibilityReport> [-AsJob] [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: NameMultipleDestinations
Move-VM [-Name] <System.String> [-DestinationHost] <System.String> [-AsJob] [-ComputerName <System.String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-DestinationCredential <System.Management.Automation.PSCredential> ] [-Passthru] [-RemoveSourceUnmanagedVhds] [-ResourcePoolName <System.String> ] [-RetainVhdCopiesOnSource] [-SmartPagingFilePath <System.String> ] [-SnapshotFilePath <System.String> ] [-Vhds <System.Collections.Hashtable[]> ] [-VirtualMachinePath <System.String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: NameMultipleDestinationsAndCimSession
Move-VM [-Name] <System.String> [-DestinationCimSession] <Microsoft.Management.Infrastructure.CimSession> -VirtualMachinePath <System.String> [-AsJob] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-Passthru] [-RemoveSourceUnmanagedVhds] [-ResourcePoolName <System.String> ] [-RetainVhdCopiesOnSource] [-SmartPagingFilePath <System.String> ] [-SnapshotFilePath <System.String> ] [-Vhds <System.Collections.Hashtable[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: NameSingleDestination
Move-VM [-Name] <System.String> [-DestinationHost] <System.String> [-AsJob] [-ComputerName <System.String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-DestinationCredential <System.Management.Automation.PSCredential> ] [-DestinationStoragePath <System.String> ] [-IncludeStorage] [-Passthru] [-RemoveSourceUnmanagedVhds] [-ResourcePoolName <System.String> ] [-RetainVhdCopiesOnSource] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: NameSingleDestinationAndCimSession
Move-VM [-Name] <System.String> [-DestinationCimSession] <Microsoft.Management.Infrastructure.CimSession> [-AsJob] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-DestinationStoragePath <System.String> ] [-IncludeStorage] [-Passthru] [-RemoveSourceUnmanagedVhds] [-ResourcePoolName <System.String> ] [-RetainVhdCopiesOnSource] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMMultipleDestinations
Move-VM [-VM] <Microsoft.HyperV.PowerShell.VirtualMachine> [-DestinationHost] <System.String> [-AsJob] [-DestinationCredential <System.Management.Automation.PSCredential> ] [-Passthru] [-RemoveSourceUnmanagedVhds] [-ResourcePoolName <System.String> ] [-RetainVhdCopiesOnSource] [-SmartPagingFilePath <System.String> ] [-SnapshotFilePath <System.String> ] [-Vhds <System.Collections.Hashtable[]> ] [-VirtualMachinePath <System.String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMMultipleDestinationsAndCimSession
Move-VM [-VM] <Microsoft.HyperV.PowerShell.VirtualMachine> [-DestinationCimSession] <Microsoft.Management.Infrastructure.CimSession> -VirtualMachinePath <System.String> [-AsJob] [-Passthru] [-RemoveSourceUnmanagedVhds] [-ResourcePoolName <System.String> ] [-RetainVhdCopiesOnSource] [-SmartPagingFilePath <System.String> ] [-SnapshotFilePath <System.String> ] [-Vhds <System.Collections.Hashtable[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMSingleDestination
Move-VM [-VM] <Microsoft.HyperV.PowerShell.VirtualMachine> [-DestinationHost] <System.String> [-AsJob] [-DestinationCredential <System.Management.Automation.PSCredential> ] [-DestinationStoragePath <System.String> ] [-IncludeStorage] [-Passthru] [-RemoveSourceUnmanagedVhds] [-ResourcePoolName <System.String> ] [-RetainVhdCopiesOnSource] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMSingleDestinationAndCimSession
Move-VM [-VM] <Microsoft.HyperV.PowerShell.VirtualMachine> [-DestinationCimSession] <Microsoft.Management.Infrastructure.CimSession> [-AsJob] [-DestinationStoragePath <System.String> ] [-IncludeStorage] [-Passthru] [-RemoveSourceUnmanagedVhds] [-ResourcePoolName <System.String> ] [-RetainVhdCopiesOnSource] [-Confirm] [-WhatIf] [ <CommonParameters>]




Detailed Description

The Move-VM cmdlet moves a virtual machine to a new Hyper-V host.

Parameters

-AsJob

Runs the cmdlet as a background job.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CimSession<Microsoft.Management.Infrastructure.CimSession[]>

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CompatibilityReport<VMCompatibilityReport>

Specifies a compatibility report which includes any adjustments required for the move.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-ComputerName<System.String[]>

Specifies one or more Hyper-V hosts that run this cmdlet. NetBIOS names, IP addresses, and fully qualified domain names are allowable. The default is the local computer. Use localhost or a dot (.) to specify the local computer explicitly.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Credential<System.Management.Automation.PSCredential[]>

Specifies one or more user accounts that have permission to perform this action. The default is the current user.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DestinationCimSession<Microsoft.Management.Infrastructure.CimSession>

Specifies the CIMSession on the Hyper-V host to which the virtual machine is to be moved.


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DestinationCredential<System.Management.Automation.PSCredential>

Specifies a user account that has permission to perform this action. The default is the current user.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DestinationHost<System.String>

Specifies the Hyper-V host to which the virtual machine is to be moved.


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DestinationStoragePath<System.String>

Specifies a destination storage path to which all virtual machine storage is to be moved.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IncludeStorage

Specifies that both the virtual machine and its storage are to be moved.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<System.String>

Specifies the friendly name of the virtual machine to be moved.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true(ByValue)

Accept Wildcard Characters?

false

-Passthru

Specifies that an object is to be passed through to be pipeline representing the moved virtual machine.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RemoveSourceUnmanagedVhds

Indicates that Hyper-V deletes the parent virtual hard disk on the source after this cmdlet moves a differencing virtual hard disk, when the migration is finished.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ResourcePoolName<System.String>

Specifies the name of the processor resource pool to be used.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RetainVhdCopiesOnSource

Indicates that this cmdlet retains parent virtual hard disks on the source computer.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SmartPagingFilePath<System.String>

Specifies the new path to use for a smart paging file, if one is needed.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SnapshotFilePath<System.String>

Specifies the path for any snapshot files associated with the virtual machine.


Aliases

CheckpointFileLocation,SnapshotFileLocation

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Vhds<System.Collections.Hashtable[]>

Specifies an array of hashtables that contain locations for each individual virtual hard disk to be moved. Each hashtable should have two entries. The first entry specifies the current location of the virtual hard disk to move, and has a key of SourceFilePath. The second entry specifies the new location for the virtual hard disk, and has a key of DestinationFilePath. The virtual hard disk name must be identical in both entries.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VirtualMachinePath<System.String>

Specifies the path where the virtual machine configuration files are to be stored.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<Microsoft.HyperV.PowerShell.VirtualMachine>

Specifies the virtual machine to be moved.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true(ByValue)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • None, by default. Microsoft.HyperV.PowerShell.VirtualMachine if the migration succeeds and -PassThru is specified. Microsoft.HyperV.PowerShell.CompatibilityReport if the migration fails because of an incompatibility.


Examples

Example 1

Moves a virtual machine test VM to a remote computer remoteServer when the virtual machine is stored on an SMB share.


PS C:\> Move-VM "Test VM" remoteServer

Example 2

Moves virtual machine test VM to remote computer remoteServer, and moves all files associated with the virtual machine to D:\TestVM on the remote computer.


PS C:\> Move-VM "Test VM" remoteServer –IncludeStorage –DestinationStoragePath D:\TestVM

Example 3

Moves a virtual machine Test VM to a remote computer remoteServer and places the files associated with the virtual machine in the specified locations under D:\TestVM on the remote computer.


PS C:\> Move-VM "Test VM" remoteServer –VirtualMachinePath D:\TestVM\Config –SnapshotFilePath D:\TestVM\Snapshots –SmartPagingFilePath D:\TestVM\SmartPaging –IncludeStorage –VHDs @(@{"SourceFilePath" = "C:\TestVM\Disk1.VHDX"; "DestinationFilePath" = "D:\TestVM\Disks\Disk1.VHDX"}, @{"SourceFilePath" = "C:\TestVM\Disk2.VHDX"; "DestinationFilePath" = "D:\TestVM\Disks\Disk2.VHDX"})

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft