How to get ESXi HBA information PowerCLI
If you want to gather information about you VMware ESXi Storage Connection information about HBA.
Below are the script which I tested and its works for me Its generate Cluster Name , ESXi Host name ,HBA card No, WWPN.
Below are the script. copy in notepad and save as hbainfo.ps1
#Initialize variables $VCServer = "vcserver.yourdomain.local" $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