Get-HardDisk Command | Vmware PowerCLI Reference

Get-HardDisk

This cmdlet returns the virtual hard disks available on a vCenter Server system. You can retrieve a hard disk by specifying the virtual machines, templates, or snapshots to which it belongs. If the hard disk is not attached to any virtual machines, templates, or snapshots, you can search for it in datastores or retrieve it by providing a datastore path to the file where the virtual hard disk is stored. In this case, you might not be able to derive disk type info, and the value of the DiskType property of the hard disk is Unknown.

Syntax

Get-HardDisk
-VMGuestDisk < VMGuestDisk[] >
[-ProgressAction < ActionPreference > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
VMGuestDisk VMGuestDisk[] named
  • pipeline
Specifies the virtual machines guest disk from which you want to retrieve the hard disks.
optional ProgressAction ActionPreference named

Output

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

Examples

Example 1

Get-HardDisk -VM VM

Retrieves the hard disks of the virtual machine named VM.

Example 2

Get-HardDisk -VM $vm -DiskType flat

Retrieves the flat hard disks from the specified virtual machines.

Example 3

Get-HardDisk -Datastore "Storage1" -DatastorePath "[Storage1] myVM/"

Retrieves the hard disks from the specified datastore and from the specified datastore path.

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.