Automation

 View Only
Expand all | Collapse all

How to get eui id using VML ID ?

LucD

LucDNov 29, 2021 11:37 AM

LucD

LucDNov 29, 2021 12:13 PM

  • 1.  How to get eui id using VML ID ?

    Posted Nov 29, 2021 09:50 AM

    Hi,

    I have the below script which provide me the eui and its associated vml

    $esxName = "myesx01"
    $esx = Get-VMHost $esxName
    $esx.ExtensionData.Config.StorageDevice.ScsiLun |
    Select @{N="ESX";E={$esx.Name}},
    CanonicalName,
    @{N="VML";E={$_.Descriptor | where {$_.Id -match "^vml"} | Select -ExpandProperty Id}} | ft -auto

    I would like to know, how can i get the eui details using the vml which I have ?

    Please help!!!



  • 2.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 10:50 AM

    WHat do you mean by "eui details"?



  • 3.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 10:58 AM

    LucD,

    like naa id, few storage would have eui id for the volumes.

    ganapa2000_0-1638183454063.png

     



  • 4.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 11:04 AM

    If you want to select a LUN via a specific EUI, then you would need to use a Where-clause.



  • 5.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 11:07 AM

    LucD,

    I have a vml id, I need to get the eui id using that ? not sure, how to get that ?

    I tried as below, but it returns blank

    $myvml = "01000300003431373861313338313438323331373136633963653930303430636430336264536572766572"
    $esxName = "myesx"
    $esx = Get-VMHost $esxName
    $esx.ExtensionData.Config.StorageDevice.ScsiLun | Select @{N="VML1";E={$_.Descriptor | where {"^eui" -match $myvml} | Select -ExpandProperty Id}} | ft -auto



  • 6.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 11:37 AM

    Would this work?



  • 7.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 11:54 AM

    Not, it shows blank

    If I execute excluding where, I get below

    $myvml = "01000300003431373861313338313438323331373136633963653930303430636430336264536572766572"
    $esxName = "myesx"
    $esx = Get-VMHost $esxName
    $esx.ExtensionData.Config.StorageDevice.ScsiLun

    ganapa2000_0-1638186968945.png

     



  • 8.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 12:13 PM

    You didn't use the Where-clause



  • 9.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 12:14 PM

    I used the where clause, I got blank output



  • 10.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 01:37 PM

    This is all one line:

    $esx.ExtensionData.Config.StorageDevice.ScsiLun | Where-Object {$_.Vml -match $myVML} | Select-Object -Property CanonicalName



  • 11.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 02:00 PM

    yes, I tried the same, but still not getting the any output

    $myvml = "vml.01000300003431373861313338313438323331373136633963653930303430636430336264536572766572"
    $esxName = "myesx"
    $esx = Get-VMHost $esxName
    $esx.ExtensionData.Config.StorageDevice.ScsiLun | where{$_.vml -match $myvml} | Select CanonicalName



  • 12.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 02:09 PM

    Where did you get that VML property from in the screenshot?



  • 13.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 02:17 PM

    Yeah, good catch. I didn't even think about the fact that "vml" isn't even a listed property. I haven't finished my second tankard of coffee yet. He should be comparing $MyVML to $_.Uuid  


    ganapa2000, the statement should be:

    $esx.ExtensionData.Config.StorageDevice.ScsiLun | Where-Object {$_.Uuid -match $myVML} | Select-Object -Property CanonicalName



  • 14.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 02:10 PM

    Okay, then then it means that none of the LUNS are matching that ID number. You can verify that by taking the Where-Object statement out and viewing the results:

    $esx.ExtensionData.Config.StorageDevice.ScsiLun | Select-Object -Property CanonicalName

    I'd also suggest assigning $myvml dynamically, rather than setting it as a static value in case it changes, but that's a bit of a quibble.



  • 15.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 02:15 PM

    vml exists and I am able to get the canonical name, but rather going through huge list, I would like to query the vml to get the corresponding canonical name

    4th one in the below the output is the vml, that i am querying

    ganapa2000_0-1638195263402.png

     



  • 16.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 02:31 PM

    I'd like to see the command you used to list the VML property in your second screenshot, because I don't see that property in the first one.

    Can you also add the LunType property?



  • 17.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 02:32 PM

    here is the command, which i used

    $esxName = "myesx"
    $esx = Get-VMHost $esxName
    $esx.ExtensionData.Config.StorageDevice.ScsiLun |
    Select @{N="ESX";E={$esx.Name}},
    CanonicalName,
    @{N="VML";E={$_.Descriptor | where {$_.Id -match "^vml"} | Select -ExpandProperty Id}} | ft -auto



  • 18.  RE: How to get eui id using VML ID ?
    Best Answer

    Posted Nov 29, 2021 02:41 PM

    Okay, so "VML" is a calculated property. I gotcha now. Seems overly complex, but I can roll with it.

    Here's the thing, since that's not a standard property, you need to provide that context in order to use it:

    If you plan on reusing that property, you should save it into an array:

    $myvml = "01000300003431373861313338313438323331373136633963653930303430636430336264536572766572"
    $VMLObjs = $esx.ExtensionData.Config.StorageDevice.ScsiLun | Select-Object @{N="ESX";E={$esx.Name}}, CanonicalName, @{N="VML";E={$_.Descriptor | where {$_.Id -match "^vml"} | Select -ExpandProperty Id}}
    $VMLObjs | Where-Object {$_.VML -match $myvml }

    If you don't plan on reusing your calculated VML property, then you can just pipe it into Where-Object:

    $esx.ExtensionData.Config.StorageDevice.ScsiLun | Select-Object @{N="ESX";E={$esx.Name}}, CanonicalName, @{N="VML";E={$_.Descriptor | where {$_.Id -match "^vml"} | Select -ExpandProperty Id}} | Where-Object {$_.VML -match $myvml }

    If you don't want the hassle of a calculated property, you can just match $myvml to the Uuid property, as suggested above. Whatever works for ya.



  • 19.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 02:51 PM

    Perfect...Since I wanted only the canonical name using the vml id, I modified as below and that worked

    Thank you very much

    $myvml = "01000300003431373861313338313438323331373136633963653930303430636430336264536572766572"
    $esxName = "myesx"
    $esx = Get-VMHost $esxName
    $VMLObjs = $esx.ExtensionData.Config.StorageDevice.ScsiLun | Select-Object @{N="ESX";E={$esx.Name}}, CanonicalName, @{N="VML";E={$_.Descriptor | where {$_.Id -match "^vml"} | Select -ExpandProperty Id}}
    $VMLObjs | Where-Object {$_.VML -match $myvml} | Select -ExpandProperty CanonicalName



  • 20.  RE: How to get eui id using VML ID ?

    Posted Nov 29, 2021 03:11 PM

    Awesome. Glad I could help.