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

[-DiskType  <DiskType[]>]
[-Id  <String[]>]
[-Path  <DatastoreItem[]>]
[-Server  <VIServer[]>]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
optional
DiskType
DiskType[] named Specifies the type of the hard disks you want to retrieve. The valid values are rawVirtual, rawPhysical, flat, and unknown. If the hard disk is not attached to any virtual machines, templates, or snapshots, you can 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.
optional
Id
String[] named
  • wildcards
  • Specifies the IDs of the hard disks you want to retrieve.
    optional
    Path
    DatastoreItem[] named
  • wildcards
  • Specifies the file paths to the virtual hard disks you want to retrieve. The cmdlet searches recursively the specified locations.
    optional
    Server
    VIServer[] named
  • wildcards
  • Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.

    -VMGuestDisk  <VMGuestDisk[]>
    [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.

    -Datastore  <Datastore[]>
    [-DatastorePath  <String[]>]
    [-DiskType  <DiskType[]>]
    [-Id  <String[]>]
    [-Server  <VIServer[]>]
    [CommonParameters]

    Parameters

    Required Parameter Name Type Position Features Description
    required
    Datastore
    Datastore[] named
  • wildcards
  • pipeline
  • Specifies the datastores or datastore clusters you want to search for hard disks. This parameter is required when retrieving a hard disk that is attached to no virtual machines, templates, or snapshots.
    optional
    DatastorePath
    String[] named
  • wildcards
  • Specifies datastore paths to the hard disks you want to retrieve. The paths must be in the following format: [datastore_name] , where [datastore_name] is the name of the datastore in square brackets and is a slash-delimited path from the root of the datastore to the virtual hard disk file. The cmdlet searches recursively the specified locations.
    optional
    DiskType
    DiskType[] named Specifies the type of the hard disks you want to retrieve. The valid values are rawVirtual, rawPhysical, flat, and unknown. If the hard disk is not attached to any virtual machines, templates, or snapshots, you can 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.
    optional
    Id
    String[] named
  • wildcards
  • Specifies the IDs of the hard disks you want to retrieve.
    optional
    Server
    VIServer[] named
  • wildcards
  • Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.

    -RelatedObject  <HardDiskRelatedObjectBase[]>
    [CommonParameters]

    Parameters

    Required Parameter Name Type Position Features Description
    required
    RelatedObject
    HardDiskRelatedObjectBase[] named
  • pipeline
  • Specifies objects to retrieve one or more HardDisk objects that are related to them.

    [[-Template]  <Template[]>]
    [[-Snapshot]  <Snapshot[]>]
    [-DiskType  <DiskType[]>]
    [-Id  <String[]>]
    [-Name  <String[]>]
    [-Server  <VIServer[]>]
    [-VM  <VirtualMachine[]>]
    [CommonParameters]

    Parameters

    Required Parameter Name Type Position Features Description
    optional
    Template
    Template[] 1
  • wildcards
  • pipeline
  • Specifies the virtual machine templates from which you want to retrieve the hard disks.
    optional
    Snapshot
    Snapshot[] 2
  • pipeline
  • Specifies the snapshots from which you want to retrieve the hard disks.
    optional
    DiskType
    DiskType[] named Specifies the type of the hard disks you want to retrieve. The valid values are rawVirtual, rawPhysical, flat, and unknown. If the hard disk is not attached to any virtual machines, templates, or snapshots, you can 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.
    optional
    Id
    String[] named
  • wildcards
  • Specifies the IDs of the hard disks you want to retrieve.
    optional
    Name
    String[] named
  • wildcards
  • Specifies the names of the SCSI hard disks you want to retrieve.
    optional
    Server
    VIServer[] named
  • wildcards
  • Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.
    optional
    VM
    VirtualMachine[] named
  • wildcards
  • pipeline
  • Specifies the virtual machines from which you want to retrieve the hard disks.

    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

    Feedback

    Was this page helpful?