This is an update to my original get-WWN script using Get-View. Get-VMHostHba was pointed out to me by Robert van den Nieuwendijk, vExpert 2012, so I wanted to provide an update to my original post HERE. I attached the ps1 file at the end.
With the addition of get-vmhosthba in PowerCLI, you can get this information somewhat easier. At line 46
1 |
$hbas = Get-View (Get-View (Get-VMHost -Name $vmhost).ID).ConfigManager.StorageSystem |
becomes
1 |
$hbas = Get-VMHostHba -vmhost $vmhost -Type FibreChannel |
Since that pulls only fibre channel HBAs, the foreach changes to simply $hba in $hbas, and the if statement is no longer needed (line 47-50):
1 2 3 4 |
foreach ($hba in $hbas){ $wwpn = "{0:x}" -f $hba.PortWorldWideName Write-Host -foregroundcolor green `t "World Wide Port Name:" $wwpn } |
Here’s the new version –> Get-WWN.ps1