rindr
Contributor
Contributor

Get datastores extents display names

Jump to solution

Hi,

I am using PowerCLI 5.1

I am able to get the datastore name + its first respective extent this way:

Get-Datastore | where {$_.type -eq "VMFS"} | % { write-host $_.Name $($_.ExtensionData.Info.Vmfs.Extent[0]).DiskName }


But it returns just a canonical name, not the full display name like DGC Fibre...(<canonical name>) or Local VMware Disk (<canonical name>) which is seen in GUI for a selected datastore under Extents.

Is it possible to retrieve the full display name of the first extent for all datastores in one liner using just Get-Datastore cmdlet? So if there are 10 datastores only 10 datastore + extents display names pairs will be returned similar to above command output.

Is it doable to get a similar output like in Get HBA devices/paths list with Powercli for Device column, but without having to use Get-VMHost, Get-VMHostHba and Get-ScsiLun cmdlets since I need just 1-to-1 output for the datastore and its first extent?

Thank you,

rindr

1 Solution

Accepted Solutions
LucD
Leadership
Leadership

Try like this

Get-Datastore | where {$_.type -eq "VMFS"} |

Select Name,

    @{N="CanonicalName";E={($_.ExtensionData.Info.Vmfs.Extent[0]).DiskName}},

    @{N="DisplayName";E={(Get-ScsiLun -CanonicalName ($_.ExtensionData.Info.Vmfs.Extent[0]).DiskName -VMHost (Get-VIObjectByVIView $_.ExtensionData.Host[0].Key)).ExtensionData.DisplayName}}


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

View solution in original post

2 Replies
LucD
Leadership
Leadership

Try like this

Get-Datastore | where {$_.type -eq "VMFS"} |

Select Name,

    @{N="CanonicalName";E={($_.ExtensionData.Info.Vmfs.Extent[0]).DiskName}},

    @{N="DisplayName";E={(Get-ScsiLun -CanonicalName ($_.ExtensionData.Info.Vmfs.Extent[0]).DiskName -VMHost (Get-VIObjectByVIView $_.ExtensionData.Host[0].Key)).ExtensionData.DisplayName}}


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

View solution in original post

rindr
Contributor
Contributor

Hi LucD,

Sweet.Thank you for the hint regarding Get-VIObjectByVIView. It is a slower than pure Get-Datastore command, but I am getting the information I need in one liner now:

Get-Datastore | where { $_.type -eq "VMFS" } | %{ (Get-ScsiLun -CanonicalName ($_.ExtensionData.Info.Vmfs.Extent[0]).DiskName -VMHost (Get-VIObjectByVIView $_.ExtensionData.Host[0].Key)).ExtensionData.DisplayName }

0 Kudos