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!!!
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.
WHat do you mean by "eui details"?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
like naa id, few storage would have eui id for the volumes.
If you want to select a LUN via a specific EUI, then you would need to use a Where-clause.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
Would this work?
$myvml = "01000300003431373861313338313438323331373136633963653930303430636430336264536572766572"
$esxName = "myesx"
$esx = Get-VMHost $esxName
$esx.ExtensionData.Config.StorageDevice.ScsiLun |
where{$_.Vml -match $myVML} |
Select CanonicalName
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
You didn't use the Where-clause
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I used the where clause, I got blank output
This is all one line:
$esx.ExtensionData.Config.StorageDevice.ScsiLun | Where-Object {$_.Vml -match $myVML} | Select-Object -Property CanonicalName
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
Where did you get that VML property from in the screenshot?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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.
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
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
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?
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
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.
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
Awesome. Glad I could help.