Copy-HardDisk Command | Vmware PowerCLI Reference

Copy-HardDisk

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

Syntax

Copy-HardDisk
[ -HardDisk ] < HardDisk[] >
-DestinationPath < String >
[-DestinationStorageFormat < VirtualDiskStorageFormat > ]
[-Force ]
[-ProgressAction < ActionPreference > ]
[-RunAsync ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
HardDisk HardDisk[] 1
  • pipeline
Specifies the virtual hard disk you want to copy.
required
DestinationPath String named
Specifies 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.
optional DestinationStorageFormat VirtualDiskStorageFormat named
Specifies the type of the hard disk copy. The valid values are Thin, Thick, and EagerZeroedThick. This parameter is only applicable when you are connected to an ESX/ESXi host.
optional Force SwitchParameter named
Indicates whether to overwrite all disks with the same name at the provided destination.
optional ProgressAction ActionPreference named
optional RunAsync SwitchParameter named
Indicates 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 VMware PowerCLI console.

Output

VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.HardDisk

Examples

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.

Related Commands

HardDisk

Copies a virtual hard disk to another destination.

This cmdlet retrieves the virtual hard disks available on a vCenter Server system.

This cmdlet moves a hard disk from one location to another.

This cmdlet creates a new hard disk on the specified location.

This cmdlet removes the specified virtual hard disks.

This cmdlet modifies the properties of the specified virtual hard disk.