Move-VM

Move-VM

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

構文

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

詳細説明

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

パラメーター

-AsJob

Runs the cmdlet as a background job.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

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

リモート セッションまたはリモート コンピューターでコマンドレットを実行します。コンピューター名またはセッション オブジェクト (New-CimSession コマンドレットや Get-CimSession コマンドレットの出力など) を入力します。既定値は、ローカル コンピューター上の現在のセッションです。

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-CompatibilityReport<VMCompatibilityReport>

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

Aliases

none

必須/オプション

true

位置

1

既定値

none

パイプライン入力の受け入れ

True (ByValue)

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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

必須/オプション

true

位置

2

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-DestinationHost<System.String>

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

Aliases

none

必須/オプション

true

位置

2

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-DestinationStoragePath<System.String>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-IncludeStorage

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-Name<System.String>

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

Aliases

none

必須/オプション

true

位置

1

既定値

none

パイプライン入力の受け入れ

true(ByValue)

ワイルドカード文字の受け入れ

false

-Passthru

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-ResourcePoolName<System.String>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-RetainVhdCopiesOnSource

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-SmartPagingFilePath<System.String>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-SnapshotFilePath<System.String>

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

Aliases

CheckpointFileLocation,SnapshotFileLocation

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-VirtualMachinePath<System.String>

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

Aliases

none

必須/オプション

true

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-VM<Microsoft.HyperV.PowerShell.VirtualMachine>

Specifies the virtual machine to be moved.

Aliases

none

必須/オプション

true

位置

1

既定値

none

パイプライン入力の受け入れ

true(ByValue)

ワイルドカード文字の受け入れ

false

-Confirm

コマンドレットを実行する前に確認メッセージを表示します。

必須/オプション

false

位置

named

既定値

false

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-WhatIf

コマンドレットが実行された場合に何が起きるのかを示します。コマンドレットは実行されません。

必須/オプション

false

位置

named

既定値

false

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

<CommonParameters>

このコマンドレットは共通のパラメーターをサポートしています(-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、および -OutVariable)。詳細については、TechNet の「 「about_CommonParameters」 (https://go.microsoft.com/fwlink/p/?LinkID=113216) を参照してください。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

出力

出力型は、コマンドレットが出力するオブジェクトの型です。

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

使用例

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