PowerCLI

 View Only
Expand all | Collapse all

How to get a list of hard disks in ESXi host system ?

  • 1.  How to get a list of hard disks in ESXi host system ?

    Posted Sep 01, 2015 03:52 PM

    I am wondering if it is possible to get a list of hard disks that are in the server running esxi through either CIM or PowerCLI, is that doable ?  I was browsing CIM classes but could not find anything that would relate to local disks. Vsphere client on the other hand in the Hardware Status panel, is listing disks and the controller.



  • 2.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Sep 01, 2015 04:05 PM

    Check this page: Hardware Monitoring in ESXi - Support Insider - VMware Blogs

    You need install management tools provided by your hardware vendor.



  • 3.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Sep 02, 2015 08:47 AM

    How does this help me to get the list of the physical hard disks inside the esxi ? Like i have mentioned, i can see those disks by checking the hardware status tab, they are there, but i need a scripted method to get this data.



  • 4.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Sep 02, 2015 07:29 PM

    I'm going to assume you're talking about local drives mounted to the ESXi host. Connect to the target vCenter(s) and run this line.

    get-view -ViewType datastore | select name, @{N="Local Drive?";E={!$_.summary.multiplehostaccess}}

    Let me know how this works out.



  • 5.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Sep 03, 2015 10:28 AM

    that is checking local datastore, what i need to have is info about the real physical disks in esxi, regardles if there is a datastore build on them or not.



  • 6.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Sep 01, 2015 04:10 PM

    Hi

    Syntax

    Get-HardDisk [-Path <DatastoreItem[]>] [-DiskType <DiskType[]>] [-Server <VIServer[]>] [<CommonParameters>]

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

    Get-HardDisk [-DiskType <DiskType[]>] [[-VM] <VirtualMachine[]>] [[-Template] <Template[]>] [[-Snapshot] <Snapshot[]>] [-Server <VIServer[]>] [<CommonParameters>



  • 7.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Sep 02, 2015 08:46 AM

    This cmdlet is not for checking physical disks inside esxi...



  • 8.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Sep 03, 2015 07:29 AM

    You can also use get-scsilun ​cmdlet.



  • 9.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Sep 03, 2015 10:35 AM

    Hi,

      with this i can get info about the virtual disk that was built on raid controller, so basically it shows that i have 1 disk 136 GB, where in reality i have inside 2 disks , on top of which i have raid 1 mirror on them. which is 136, I am looking for this information:



  • 10.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Feb 05, 2021 10:09 PM

    When I run get-scsilun , I get command not found.

    When I run esxcfg-scsidevs -l , I only see the raid controller details. It does not show any disks underneath. I know I have 8 hdds of vendor "SEAGATE"

    How can I see all the details of the disks like vendor, model, serial no, speed, interface etc...

    Would really appreciate your response

    Thank you

    -Dee  



  • 11.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Sep 03, 2015 01:08 PM

    Ok i have figured out 1 way of doing this for HP blades that i have:

    $esxi = 'myhost'

    $CIMOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 –UseSsl

    $Session = New-CimSession -Authentication Basic -Credential $cred -ComputerName $esxi -port 443 -SessionOption $CIMOpt

    Get-CimInstance  -CimSession $Session -Namespace 'root/cimv2' -ClassName 'CIM_StorageExtent' | ?{$_.CreationClassName -eq 'HPVC_SAStorageExtent'} | Select PSComputerName, Caption, ElementName

    In return i get this:

    PSComputerName        Caption                                 ElementName

    --------------                     -------                                    -----------

    esxi01.local.lan             Disk 1 on HPSA1                  Disk 1 on HPSA1 : Port 1I Box 1 Bay 1 : 136GB : Data Disk

    esxi02.local.lan             Disk 2 on HPSA1                  Disk 2 on HPSA1 : Port 1I Box 1 Bay 2 : 136GB : Data Disk

    So far i got nothing better than this, so this has to do the trick :smileywink:



  • 12.  RE: How to get a list of hard disks in ESXi host system ?

    Posted Mar 08, 2024 02:49 PM

    I know it is an old thread

    But I have found a solution. 

    You can list all devices whit the command Get-EsxCli

    Example: 

    $esxcli = Get-EsxCli -VMHost <HOSTNAME/IP> -V2

    $esxcli.storage.core.device.list.Invoke()