Retrieving NVMe details through PowerCLI

Recently I was contacted and asked if there was a way to retrieve information about the NVMe Drives in an ESXi host, this information is easily accessible via ESXCLI using the “nvme” namespaces.

Through PowerCLI this can be easily called and then each feature can be called under this namespace to give you detailed information on the NVMe devices in your ESXi host.  The reason they wanted to do this was to first check the firmware on all the NVMe devices in a cluster to see if they are at the latest revision.  Another reason they wanted this script was in case one of the NVMe devices was behaving differently than the others it would be an easy way to compare the devices.

You can see an example of the script running below:

NVMe Script output

Code

 

2 thoughts on “Retrieving NVMe details through PowerCLI

  1. Russell Baker

    Hi Alan
    Script gives error (line 24) when $feature = er. Is there something I’m missing?

    $esxcli.nvme.device.feature.$feature.get.Invoke($currentfeature)
    Message: EsxCLI.CLIFault.summary;
    InnerText: Invalid parameter: Must specify a valid namespace ID for the device whose version >=
    1.2.EsxCLI.CLIFault.summary
    At H:\Bin\PS\Get-NVMeInfo.ps1:24 char:13
    + $esxcli.nvme.device.feature.$feature.get.Invoke($currentf …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (:) [], MethodFault
    + FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.MethodFault

    ESXi 6.5U3

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.