View Only
  • 1.  Read ESXi-Host logical volume - RAID level

    Posted Sep 21, 2014 06:12 PM

    Hi all,

    is it possible to read the RAID Level of an ESXi Host via PowerCLI ?

    I would like to check multiple ESX-Host, if they are built on a RAID.

    Thx in advance


  • 2.  RE: Read ESXi-Host logical volume - RAID level

    Posted Sep 22, 2014 12:19 AM

    Hello, chakoe-

    At least one way to do it, if you have the CIM providers running in your ESXi instance for the hardware on which it is running, is to get such info from the resultant info.  We at wrote about doing so in our post, "VMHost Logical Drive Info from CIM Provider with PowerCLI".

    Give that a look -- does that suit your need?

  • 3.  RE: Read ESXi-Host logical volume - RAID level

    Posted Sep 23, 2014 04:17 PM


    your function looks good, but in my environment, it does nothing :-(

    I created a .ps1-File, just copied your function into it, saved it under the same name you used and then tried to test it.

    first of all, i used an connect-viserver...

    then i started the script with the function in it and nothing happended. Just the prompt appears .

  • 4.  RE: Read ESXi-Host logical volume - RAID level

    Posted Sep 24, 2014 09:30 PM

    Hello, chakoe-

    It sounds like you may not have yet _called_ the function, only defined it in your current PowerShell session.  By pasting the function definition into a .ps1 file, and then dot-sourcing the .ps1 file, you define the function within the current PowerShell session.

    The next step that you need to do after that is then actually call the function that you have defined in the session.  So, altogether, it would look something like:

    ## dot-source the function definition file
    . c:\temp\vNuggletsLogicalDriveFunction.ps1
    ## then, actually call the function
    Get-VNVMHostLogicalVolumeInfo -VMHostName
    ## or, call it with no parameters to get logical volume info for all VMHosts in the vCenter to which you are connected

    That should give some output like:

    Name                logicalVol
    ----                ----------   Logical Volume 1 on HPSA1 : RAID 1 : 136GB : Disk 1,2,3

    That work out for you?

  • 5.  RE: Read ESXi-Host logical volume - RAID level

    Posted Sep 26, 2014 11:42 AM

    hmmm no, sorry...

    PS D:\VCenter-Skripte\Host-Operations> ./Get-VNVMHostLogicalVolumeInfo.ps1

    PS D:\VCenter-Skripte\Host-Operations> ./Get-VNVMHostLogicalVolumeInfo.ps1 -VMHostName e998spwesx4001n.e998.intern

    no Output... here´s the content of the ps1-File

    <# .Description

        Get logical volume info for HP VMHosts from StorageStatusInfo of their managed objects. Depends on CIM provider being installed and in good health (responsive and whatnot), presumably

        Author: -- Aug 2012


    function Get-VNVMHostLogicalVolumeInfo {


            ## name of VMHost to check; if none, queries all hosts


        ) ## end param

        ## make the Get-View expression to invoke

        $strGetViewExpr = 'Get-View -ViewType HostSystem -Property Name,Runtime.HealthSystemRuntime.HardwareStatusInfo.StorageStatusInfo'

        if ($VMHostName_str) {$strGetViewExpr += " -Filter @{'Name' = '$VMHostName_str'}"}

        Invoke-Expression $strGetViewExpr | Select name,


            e={($_.Runtime.HealthSystemRuntime.HardwareStatusInfo.StorageStatusInfo | `

                ?{$_.Name -like "Logical*"} | %{$_.Name}) -join ", "}}

    } ## end function

  • 6.  RE: Read ESXi-Host logical volume - RAID level
    Best Answer

    Posted Sep 26, 2014 11:31 PM


    You are not quite calling things correctly.  There are two (2) distinct things that you need to do:

    1. "dot-source" the .ps1 file in which the function is defined by doing something like, ". c:\temp\functionDefinitionfilename.ps1"
    2. _then_ you must call the function name (not the name of the .ps1 file), and can pass parameters (like "Get-VNVMHostLogicalVolumeInfo -VMHostName"

    For item 0, you _must_ include the period and the space before the name of the file in which the function is defined.  That action is what makes the function "Get-VNVMHostLogicalVolumeInfo" available in your PowerShell session.  That is "dot-sourcing".

    Then, for item 1, that is the function name, "Get-VNVMHostLogicalVolumeInfo", not the name of the function definition file (the .ps1 file).  Until you do those two things, you will continue to get zero output.  Do you follow?