How to get HBA WWPN of ESXi hosts

It’s busy month, I haven’t update my blog since I back from Phuket with my wife. I’m running into multiple projects, a little overload.

Just a quick share, my storage team ask me provide WWPN of all hosts to do a health check. it’s nightmare to pull out the data from vSphere client or web client. Just found a way to get it.

Get-VMHost -Location | Get-VMHostHBA -type fibrechannel | select VMHost,Device,@{N=”WWPN”;E={“{0:X}” -f $_.PortWorldWideName}}

Especially “{0:X}” -f $_.PortWorldWideName}

{0:X} is format, check out here  to find more.

-f is kind of pipeline.

$_.PortWorldWideName is the value you want to convert.