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>]

Detaillierte Beschreibung

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

Parameter

-AsJob

Runs the cmdlet as a background job.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

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

Das Cmdlet wird in einer Remotesitzung oder auf einem Remotecomputer ausgeführt. Geben Sie einen Computernamen oder ein Sitzungsobjekt ein, wie z. B. die Ausgabe eines New-CimSession oder Get-CimSession-Cmdlets. Der Standardwert ist die aktuelle Sitzung auf dem lokalen Computer.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-CompatibilityReport<VMCompatibilityReport>

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

Aliase

none

Erforderlich?

true

Position?

1

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByValue)

Platzhalterzeichen akzeptieren?

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-DestinationCimSession<Microsoft.Management.Infrastructure.CimSession>

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

Aliase

none

Erforderlich?

true

Position?

2

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-DestinationCredential<System.Management.Automation.PSCredential>

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-DestinationHost<System.String>

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

Aliase

none

Erforderlich?

true

Position?

2

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-DestinationStoragePath<System.String>

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-IncludeStorage

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Name<System.String>

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

Aliase

none

Erforderlich?

true

Position?

1

Standardwert

none

Pipelineeingaben akzeptieren?

true(ByValue)

Platzhalterzeichen akzeptieren?

false

-Passthru

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-ResourcePoolName<System.String>

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-RetainVhdCopiesOnSource

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-SmartPagingFilePath<System.String>

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-SnapshotFilePath<System.String>

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

Aliase

CheckpointFileLocation,SnapshotFileLocation

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-VirtualMachinePath<System.String>

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

Aliase

none

Erforderlich?

true

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-VM<Microsoft.HyperV.PowerShell.VirtualMachine>

Specifies the virtual machine to be moved.

Aliase

none

Erforderlich?

true

Position?

1

Standardwert

none

Pipelineeingaben akzeptieren?

true(ByValue)

Platzhalterzeichen akzeptieren?

false

-Confirm

Fordert Sie vor der Ausführung des Cmdlet zum Bestätigen auf.

Erforderlich?

false

Position?

named

Standardwert

false

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-WhatIf

Zeit, was passieren würde, wenn das Cmdlet ausgeführt wird. Das Cmdlet wird nicht ausgeführt.

Erforderlich?

false

Position?

named

Standardwert

false

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

<CommonParameters>

Dieses Cmdlet unterstützt die allgemeinen Parameter: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer und -OutVariable. Weitere Informationen finden Sie unter about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Eingaben

Der Eingabetyp ist der Typ der Objekte, die Sie per Piping an das Cmdlet übergeben können.

Ausgaben

Der Ausgabetyp ist der Typ der Objekte, die vom Cmdlet ausgegeben werden.

  • 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.

Beispiele

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"})