Convert-VHD

Convert-VHD

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

Syntaxe

Parameter Set: Default
Convert-VHD [-Path] <String> [-DestinationPath] <String> [-AsJob] [-BlockSizeBytes <UInt32> ] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-DeleteSource] [-ParentPath <String> ] [-Passthru] [-VHDType <VhdType> {Unknown | Fixed | Dynamic | Differencing} ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Description détaillée

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

Paramètres

-AsJob

Runs the cmdlet as a background job.

Alias

none

Requis ?

false

Position ?

named

Valeur par défaut

none

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

false

-BlockSizeBytes<UInt32>

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

Alias

none

Requis ?

false

Position ?

named

Valeur par défaut

none

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

false

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

Exécute l'applet de commande dans une session distante ou sur un ordinateur distant. Entrez un nom d'ordinateur ou un objet de session, tels que le résultat d'une applet de commande New-CimSession ou Get-CimSession. La valeur par défaut est la session en cours sur l'ordinateur local.

Alias

none

Requis ?

false

Position ?

named

Valeur par défaut

none

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

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.

Alias

none

Requis ?

false

Position ?

named

Valeur par défaut

none

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

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.

Alias

none

Requis ?

false

Position ?

named

Valeur par défaut

none

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

false

-DeleteSource

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

Alias

none

Requis ?

false

Position ?

named

Valeur par défaut

none

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

false

-DestinationPath<String>

Specifies the path to the converted virtual hard disk file.

Alias

none

Requis ?

true

Position ?

2

Valeur par défaut

none

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

false

-ParentPath<String>

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

Alias

none

Requis ?

false

Position ?

named

Valeur par défaut

none

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

false

-Passthru

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

Alias

none

Requis ?

false

Position ?

named

Valeur par défaut

none

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

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

Alias

FullName

Requis ?

true

Position ?

1

Valeur par défaut

none

Accepter l'entrée de pipeline ?

True (ByValue, ByPropertyName)

Accepter les caractères génériques ?

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.

Alias

none

Requis ?

false

Position ?

named

Valeur par défaut

none

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

false

-Confirm

Vous invite à confirmer l'exécution de l'applet de commande.

Requis ?

false

Position ?

named

Valeur par défaut

false

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

false

-WhatIf

Indique ce qui se produit en cas d'exécution de l'applet de commande. L'applet de commande n'est pas exécutée.

Requis ?

false

Position ?

named

Valeur par défaut

false

Accepter l'entrée de pipeline ?

false

Accepter les caractères génériques ?

false

<CommonParameters>

Cette applet de commande prend en charge les paramètres courants : -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer et -OutVariable. Pour plus d'informations, consultez  . about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Entrées

Le type d'entrée correspond au type des objets que vous pouvez adresser à l'applet de commande.

Sorties

Le type de sortie correspond au type des objets que l'applet de commande émet.

Exemples

Example 1

This example converts a source VHD to a destination VHDX. Because the format is determined by the file name 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