Convert-VHD

Convert-VHD

Converts the format, version type, and block size of a virtual hard disk file.

语法

Parameter Set: Default
Convert-VHD [-Path] <String> [-DestinationPath] <String> [-AsJob] [-BlockSizeBytes <UInt32> ] [-ComputerName <String[]> ] [-DeleteSource] [-ParentPath <String> ] [-Passthru] [-VHDType <VhdType> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

详细说明

The Convert-VHD cmdlet converts a virtual hard disk file by copying the data from a source virtual hard disk file to a new virtual hard disk file of a specified format and version type. The format is determined by the file extension of the specified files, either .vhdx or .vhd. Conversion is an offline operation; the virtual hard disk must not be attached when the operation is started.

参数

-AsJob

Runs the operation as a background job.

别名

是否为必需?

false

位置?

named

默认值

是否接受管道输入?

false

是否接受通配符?

false

-BlockSizeBytes<UInt32>

Specifies the block size, in bytes, of the virtual hard disk after conversion.

别名

是否为必需?

false

位置?

named

默认值

是否接受管道输入?

false

是否接受通配符?

false

-ComputerName<String[]>

Specifies one or more Hyper-V hosts on which the virtual hard disk is to be converted. 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.

别名

是否为必需?

false

位置?

named

默认值

.

是否接受管道输入?

false

是否接受通配符?

false

-DeleteSource

Specifies that the source virtual hard disk is to be deleted after the conversion.

别名

是否为必需?

false

位置?

named

默认值

FALSE

是否接受管道输入?

false

是否接受通配符?

false

-DestinationPath<String>

Specifies the path to the converted virtual hard disk file.

别名

是否为必需?

true

位置?

2

默认值

是否接受管道输入?

false

是否接受通配符?

false

-ParentPath<String>

Specifies the parent path for the destination-differencing virtual hard disk file.

别名

是否为必需?

false

位置?

named

默认值

是否接受管道输入?

false

是否接受通配符?

false

-Passthru

Specifies that an object is to be passed through to the pipeline representing the converted virtual hard disk.

别名

是否为必需?

false

位置?

named

默认值

是否接受管道输入?

false

是否接受通配符?

false

-Path<String>

Specifies the path to the virtual hard disk file to be converted. If a file name or relative path is specified, the path of the converted hard disk path is calculated relative to the current working directory

别名

FullName

是否为必需?

true

位置?

1

默认值

是否接受管道输入?

True (ByValue, ByPropertyName)

是否接受通配符?

false

-VHDType<VhdType>

Specifies the type of the converted virtual hard disk. Allowed values are Fixed, Dynamic, and Differencing. The default is determined by the type of source virtual hard disk.

别名

是否为必需?

false

位置?

named

默认值

是否接受管道输入?

false

是否接受通配符?

false

-Confirm

运行 cmdlet 之前提示你进行确认。

是否为必需?

false

位置?

named

默认值

false

是否接受管道输入?

false

是否接受通配符?

false

-WhatIf

显示如果运行 cmdlet 则会发生什么情况。cmdlet 未运行。

是否为必需?

false

位置?

named

默认值

false

是否接受管道输入?

false

是否接受通配符?

false

<CommonParameters>

此 cmdlet 支持通用参数:-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer 和 -OutVariable。有关详细信息,请参阅 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

输入

输入类型是指可通过管道传送给 cmdlet 的对象的类型。

输出

输出类型是 cmdlet 所发出对象的类型。

示例

Example 1

This example converts a source VHD to a destination VHDX. Because the format is determined by the file extension and the default type is determined by the source virtual hard disk when no type is specified, the destination virtual hard disk will be a VHDX-format disk of the same type as the source virtual hard disk.

PS C:\> Convert-VHD –Path c:\test\testvhd.vhd –DestinationPath c:\test\testvhdx.vhdx

Example 2

This example converts a source differencing disk of VHDX format to a destination differencing disk of VHD format that is connected to an existing parent disk.

PS C:\> Convert-VHD –Path c:\test\child1vhdx.vhdx –DestinationPath c:\test\child1vhd.vhd –VHDType Differencing –ParentPath c:\test\parentvhd.vhd