vSphere PowerCLI Reference



Copies a virtual hard disk to another destination.


Copy-HardDisk [-HardDisk] <HardDisk[]> [-DestinationPath] <String> [-DestinationStorageFormat <VirtualDiskStorageFormat>] [-Force] [-RunAsync] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version

Detailed Description

Copies a virtual hard disk to another destination specified by the DestinationPath parameter. DestinationPath must be a datastore path to the destination folder.


NameTypeDescriptionRequired?Pipeline InputDefault Value
DestinationPathStringSpecify the datastore path to the folder where you want to copy the hard disk. The datastore name is included in the path in square braces.truefalse
HardDiskHardDisk[]Specify the virtual hard disk you want to copy.truetrue (ByValue)
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falsefalse$true
DestinationStorageFormatVirtualDiskStorageFormatSpecify the type of the hard disk copied on the new location. The valid values are Thin, Thick, Thin2GB, and Thick2GB.falsefalse
ForceSwitchParameterIndicate whether to overwrite all disks with the same name at the provided destination.falsefalse
RunAsyncSwitchParameterIndicate that the command returns immediately without waiting for the task to complete. In this mode, the output of the cmdlet is a Task object. For more information about the -RunAsync parameter run " help About_RunAsync" in the vSphere PowerCLI console.falsefalse
WhatIfSwitchParameterIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type



Supported only on ESX 4.0 and later.


-------------- Example 1 --------------

Get-HardDisk -VM $vm | Copy-HardDisk "[Storage1]/"

Retrieves the hard disks of a virtual machine and copies them into the storage1 root folder.

-------------- Example 2 --------------

Copy-HardDisk -HardDisk $hdd -DestinationPath "[Storage1] vms/disks" -DestinationStorageFormat Thick

Copies the $hdd hard disk to the "vms/disks"location on storage1 and changes the storage format of the destination disk to Thick.

Copyright © 1998 - 2011 VMware, Inc. All rights reserved.