I run a path checking script that does something similar to what Alexandru posted, but I use view instead and then rebuild the string with the colons.
# Query all ESXi hosts and their storage device configuration
Get-View -ViewType 'HostSystem' -Property Name, Config.StorageDevice | Sort-Object -Property Name | ForEach-Object {
$View = $_
# Overwrite the previous analyzing host output
Write-Host ("`r`e[2KAnalyzing host: {0}" -f $View.Name) -ForegroundColor Cyan -NoNewline
# For each Fibre Channel HBA in the host
$View.Config.StorageDevice.ScsiTopology.Adapter | Where-Object { $_.Adapter -like '*FibreChannelHba*' } | ForEach-Object {
# Extract HBA name and details
$HBAName = $_.Adapter.Split('-') | Select-Object -Last 1
$HBAInfo = $View.Config.StorageDevice.HostBusAdapter | Where-Object { $_.Device -eq $HBAName } |
Select-Object Key, Device, Status,
@{N = 'NodeWWN'; E = { (('{0:X}' -f $_.NodeWorldWideName) -split '(..)' | Where-Object { $_ }) -join ':' } },
@{N = 'PortWWN'; E = { (('{0:X}' -f $_.PortWorldWideName) -split '(..)' | Where-Object { $_ }) -join ':' } }
if (-not $HBAInfo) {
Write-Warning ("[WARNING] No HBAInfo found for host '{0}', HBA '{1}'. Skipping this HBA." -f $View.Name, $HBAName)
return
}
# Reset path state counters
$active = 0
$standby = 0
$dead = 0
# Count the number of paths in each state for this HBA
$MultipathInfo = $View.Config.StorageDevice.MultipathInfo.Lun.Path | Where-Object { $_.Adapter -eq $HBAInfo.Key }
$a = @($MultipathInfo | Where-Object { $_.PathState -like 'active' })
$s = @($MultipathInfo | Where-Object { $_.PathState -like 'standby' })
$d = @($MultipathInfo | Where-Object { $_.PathState -like 'dead' })
$active += $a.Count
$standby += $s.Count
$dead += $d.Count
# Add a record for this HBA to the results array
$NewRecord = [PSCustomObject]@{
VMHost = $View.Name
Adapter = $HBAInfo.Device
NodeWWN = $HBAInfo.NodeWWN
PortWWN = $HBAInfo.PortWWN
Status = $HBAInfo.Status
Active = $active
Standby = $standby
Dead = $dead
}
$Array += $NewRecord
}
}
Original Message:
Sent: Jul 12, 2025 11:28 AM
From: tdubb123
Subject: vmhost hba adapter wwpn not correct
When i check my wwpn from vcenter on a host vmhba: the values are:20:00:00:25:fa:40:00:74
but when i use powercli to get portworldwidenodename
get-vmhosthba:
it get: 2305843171175342366
why is that? how do i get
this
20:00:00:25:fa:40:00:74 from powercli