Try something like this
$dsTab = @{} foreach($ds in (Get-Datastore | where {$_.Type -eq "VMFS"} )){ $ds.ExtensionData.Info.Vmfs.Extent | %{ $dsTab.Add($_.DiskName,$ds.Name) } } foreach($esx in Get-VMHost){ foreach($lun in (Get-ScsiLun -VMHost $esx)){ Get-ScsiLunPath -ScsiLun $lun |
Select @{N="Host";E={$esx.Name}},@{N="LUN";E={$lun.CanonicalName}},LunPath,Preferred, @{N="DS";E={$dsTab[$_.ScsiCanonicalName]}} } }