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
great script. But get-vmhostHBA in PowerCli 4.x does function only, if all FCHba connected. ( without unbounded).
the line Write-Host -foregroundcolor green `t “World Wide Port Name:” $wwpn
could add with
…. “HBA Name: ” $hba.Device
I’m not really concerned with the name of the device, but it could be helpful for troubleshooting.
For PowerCLI 4.x, this new script didn’t work? Did you use the old version?