thanos24
Enthusiast
Enthusiast

Get-EsxCli V2 storage.core.device.list how to access device properties

Jump to solution

I am using the new Get-EsxCli -V2 option i am able to get an naa/lun device info but can't seem to figure out how to access the properties of it ??

for example:

$esxcli=Get-EsxCli -VMHost esxihost1.local -V2

$Parameters = $esxcli.storage.core.device.list.CreateArgs()

$Parameters.device = "naa.6006016037113b006bee66324508e711"

$naa=$esxcli.storage.core.device.list.Invoke($Parameters)

$naa reports the following info

AttachedFilters                       : {VAAI_FILTER}

DIXEnabled                            : false

DIXGuardType                          : NO GUARD SUPPORT

DevfsPath                             : /vmfs/devices/disks/naa.6006016037113b006bee66324508e711

Device                                : naa.6006016037113b006bee66324508e711

DeviceMaxQueueDepth                   : 32

DeviceType                            : Direct-Access

DisplayName                           : DGC Fibre Channel Disk (naa.6006016037113b006bee66324508e711)

DriveType                             : unknown

EmulatedDIXDIFEnabled                 : false

HasSettableDisplayName                : true

IsBootDevice                          : false

IsBootUSBDevice                       : false

IsLocal                               : false

IsLocalSASDevice                      : false

IsOffline                             : false

IsPerenniallyReserved                 : false

IsPseudo                              : false

IsRDMCapable                          : true

IsRemovable                           : false

IsSAS                                 : false

IsSSD                                 : false

IsSharedClusterwide                   : true

IsUSB                                 : false

IsVVOLPE                              : false

Model                                 : VRAID

MultipathPlugin                       : PowerPath

NoofoutstandingIOswithcompetingworlds : 45

NumberofPhysicalDrives                : unknown

OtherUIDs                             : {vml.02000200006006016037113b006bee66324508e711565241494420}

PIActivated                           : false

PIProtectionMask                      : NO PROTECTION

PIType                                : 0

ProtectionEnabled                     : false

QueueFullSampleSize                   : 0

QueueFullThreshold                    : 0

RAIDLevel                             : unknown

Revision                              : 0533

SCSILevel                             : 4

Size                                  : 512000

Status                                : on

SupportedGuardTypes                   : {NO GUARD SUPPORT}

ThinProvisioningStatus                : yes

VAAIStatus                            : supported

Vendor                                : DGC

But the type is

PowerCLI C:\Users\admin\Desktop\scripts> $naa.GetType()

IsPublic IsSerial Name                                     BaseType

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

True     True     Object[]                                 System.Array

I have tried access elements of $naa such as $naa[5] to get the DeviceMaxQueueDepth, but it's not a normal array Smiley Sad.  i don't use powershell on a daily basis just looking for guidance on how to access all the properties above for my NAA object? much thanks

Tags (1)
1 Solution

Accepted Solutions
mattboren
Expert
Expert

Hello, -

Quick tidbits about $naa:  that "thing" in the $naa variable is an object, and that list of stuff that you see when you inspected $naa is all of its properties.

So, to access some named property of that object, you can just use the dot (".") dereference operator.  Which is all fancy of a way to say, "in PowerShell, go like this to get that property value":

PS C:> $naa.DeviceMaxQueueDepth

How does that do for you?

View solution in original post

0 Kudos
4 Replies
mattboren
Expert
Expert

Hello, -

Quick tidbits about $naa:  that "thing" in the $naa variable is an object, and that list of stuff that you see when you inspected $naa is all of its properties.

So, to access some named property of that object, you can just use the dot (".") dereference operator.  Which is all fancy of a way to say, "in PowerShell, go like this to get that property value":

PS C:> $naa.DeviceMaxQueueDepth

How does that do for you?

0 Kudos
kwhornlcs
Enthusiast
Enthusiast

You're returning an object not an array so you'd use dot notation to access the properties listed, see some examples below:

pastedImage_21.png

thanos24
Enthusiast
Enthusiast

thanks i was typing them in after the . and trying to tab them and it was not auto tabbing so i thought otherwise Smiley Wink thank you.

0 Kudos
mattboren
Expert
Expert

Welcome.

Hm -- tab completion _should_ work on property names of objects in general (and, for that particular object type, too -- confirmed to work in my instance).  I wonder what might be causing the behavior that you are seeing of property name tab-completion not working.  Does tab completion work for you elsewhere in your PowerShell environment?

0 Kudos