How to get HBA information of all ESXi Hosts
if you want to get all inventory of HBA cards from all ESXi hosts below are the script will give you below information ,which you require in SAN Zoning and SAN LUN mapping.

#Initialize variables
$VCServer = "your VCenter Server IP Address"
$objHba = @()
#Connect to vCenter Server
Connect-VIServer $VCServer
$clusters = Get-cluster
foreach ($cluster in $clusters) {
$vmhosts = $cluster | Get-vmhost
if ($null -ne $vmhosts) {
foreach ($vmhost in $vmhosts) {
$vmhostview = $vmhost | Get-View
foreach ($hba in $vmhostview.config.storagedevice.hostbusadapter) {
if ($hba.PortWorldWideName) {
#Define Custom object
$objWwpn = "" | Select Clustername,Hostname,Hba,Wwpn
#Add porperties to the newly created object
$objWwpn.ClusterName = $cluster.Name
$objWwpn.HostName = $vmhost.Name
$objWwpn.Hba = $hba.Device
$objWwpn.Wwpn = "{0:x}" -f $hba.PortWorldWideName
$objHba += $ObjWwpn
}
}
}
}
}
$objHba | Export-Csv Get-Hba.csv
Disconnect-VIServer -Confirm:$false