Our environment is little big with multiple locations and multiple clusters. So its not easy for us to sit and work with storage team on each and every host. i worked on a script which will pull a host name, hba name, cluster name, WWN, target, lun and path counts export into excel sheet. Script is as below, which may help you at some point.
$vmhosts = Get-VMHost
$results = @()
foreach($vmhost in $vmhosts)
{
foreach($hba in (Get-VMHostHba -VMHost $vmhost -Type “FibreChannel”))
{
$wwn = $hba | Select @{N=”WWN”;E={“{0:X}” -f $_.PortWorldWideName}}
$cls = $vmhost | select @{N=”Cluster”;E={Get-Cluster -VMHost $_}}
$target = ((Get-View $hba.VMhost).Config.StorageDevice.ScsiTopology.Adapter | where {$_.Adapter -eq $hba.Key}).Target
$luns = Get-ScsiLun -Hba $hba -LunType “disk” -ErrorAction SilentlyContinue
$Paths = ($target | %{$_.Lun.Count} | Measure-Object -Sum).Sum
$cls = $vmhost | select @{N=”Cluster”;E={Get-Cluster -VMHost $_}}
$value =New-Object PSObject
$value |Add-Member -MemberType NoteProperty -Name “HostName” -Value $vmhost
$value |Add-Member -MemberType NoteProperty -Name “HBAName” -Value $hba.Device
$value |Add-Member -MemberType NoteProperty -Name “WWN” -Value $wwn.WWN
$value |Add-Member -MemberType NoteProperty -Name “Target” -Value $target.count
$value |Add-Member -MemberType NoteProperty -Name “Luns” -Value $luns.Count
$value |Add-Member -MemberType NoteProperty -Name “NumberOfPaths” -Value $Paths
$value |Add-Member -MemberType NoteProperty -Name “Cluster” -Value $cls.Cluster
$results+=$value
}
}
$results | Export-Csv -NoTypeInformation -Path F:Deviscript_outputstoragedetails.csv
