VMware Cloud Community
MichaelLeone
Enthusiast
Enthusiast

Confused about datastore name (not Canonical name)

I'm confused about something simple . I need to list out the MultiPathPolicy of all the datastores on all my hosts (this woulod be 5 ESX 4.1 hosts, and 1 ESXi 5 host, using PowerCLI v5). I was using this:

Get-VMHost | %{$_.Name; $_ | Get-ScsiLun | Select CanonicalName, MultiPathPolicy}

But that shows me the datastore name in the format "naa.600a0b800011115500005ab68a87764d", which is less than human-readable. 🙂 I want it to show as "DataStore_01", etc - the name I have given the datastore. What is that property? I tried to format-list it, but didn't see it ...

So what do I need to select to show me that?

Thanks

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership

I'm afraid the datastore name is not in there. But it is not too difficult to make the link.

You can use the New-VIproperty called lunDatastoreName for example.

Then you can do

Get-VMHost | %{$_.Name; $_ | Get-ScsiLun | Select lunDatastoreName, MultiPathPolicy}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
mcowger
Immortal
Immortal

BTW, the reason its not a property of a SCSILun is because a SCSI Lun might not have a datastore (it could be an RDM) or it might be a member extent (extended datastore).

--Matt VCDX #52 blog.cowger.us
Reply
0 Kudos
LucD
Leadership
Leadership

True, but when it is, the property will show the datastorename.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
CRad14
Hot Shot
Hot Shot

This should give you all the info you need... and as it has already been stated, not all luns are associated with a datastore

$output=@()
FOREACH($vmHost in (Get-VMHost))
{
Write-Warning "Grabbing Data for $vmhost"
FOReach($lun in ($vmHost|Get-ScsiLun))
{
$collect=""| select "Host","Datastore","Canonicalname", "MultipathPolicy"
$collect.host=$vmHost.name
$canon=$lun.CanonicalName
$collect.canonicalname=$canon
$collect.multipathpolicy=$lun.MultipathPolicy
$Datastore=(Get-Datastore|?{($_.extensiondata.info.vmfs.extent|select -expand diskname) -like $canon}).name
$collect.Datastore=$datastore
$output+=$collect
}
}
$output | FT
Conrad www.vnoob.com | @vNoob | If I or anyone else is helpful to you make sure you mark their posts as such! 🙂
Reply
0 Kudos