What is a VMware Lun?
A logical unit number (LUN ) is a logical section of storage. A LUN can be backed by a single disk or multiple disks. It can also be allocated from a disk pool/volume/aggregate depending on the storage vendor’s terminology. A datastore is a description VMware uses for an area of storage that virtual machines can reside on .
Through this script you will get the Lun path details and export to CSV format.
VM report powerCLI script :

Open the PowerCLI icon (Run as Administrator) and you can execute commands manually, run scripts manually or automate your scripts with Task Scheduler (see below).
$esxilist = 'Esxi01.test.com','Esxi02.test.com','Esxi03.test.com','Esxi04.test.com','Esxi05.test.com'
# $esxilist = Get-VMHost -Name $esxName
$report= @()
$i = 0
# $esxName = 'Esxi.test.com'
# $esxilist = Get-VMHost -Name $esxName
# $esxilist = get-cluster 'Cluster_Name'| Get-VMHost
foreach( $esxvm in $esxilist){
$i++
$esx = Get-VMHost -Name $esxvm
Write-Progress -Activity "Scanning hosts" -Status ("Host: {0}" -f $esx.Name) -PercentComplete (($i/$esxilist.count)*100) -Id 0
$esxcli = Get-EsxCli -VMHost $esxvm
Get-VMHostStorage -RescanAllHba -VMHost $esxvm| Out-Null
$hba = Get-VMHostHba -VMHost $esx -Type FibreChannel | Select -ExpandProperty Name
$storage = $esxcli.storage.core.path.list()
# $storage | Where{$hba -contains $_.Adapter} | Group-Object -Property Device | %{
$storage | Where{$hba -contains $_.Adapter} | Group-Object -Property DeviceDisplayName | %{
$row = "" | Select ESXihost, Lun, Paths
$row.ESXihost = $esx.name
$row.Lun = $_.Name
$row.Paths = $_.Group.Count
$report += $row
}
}
$report | Export-Csv LunPathInfo.csv -NoTypeInformation -UseCulture
Thanks hope you like it.
Rajiv Pandey.