VMware Cloud Community
tdubb123
Expert
Expert

get wwn with plugged in active fiber only

is it possible to get the wwn on the host with only an active fiber link only?

0 Kudos
1 Reply
deang1609
Enthusiast
Enthusiast

Are you looking to retrieve the status of the HBA adapter on the ESX(i) host or the state on each path to a SCSI device?

In the first instance, we can use the Get--VMHostHBA cmdlet to retrieve the status, as below and return the host name and the WWN where the status of the fibre channel HBA is online.

Get-VMHostHba | Where-Object {$_.Type -eq "FibreChannel" -and $_.Status -eq "Online"} | Select VMHost, NodeWorldWideName

Alternatively the below will return the WWN of the adapter and target for each host where the state of the path to a specified SCSI device is active.

$VMHosts = Get-VMHost

ForEach ($VMHost in $VMHosts)  

      {   

      $VMHost | Get-SCSILun | Get-ScsiLunPath  | Where-Object {$_.State -eq "Active" -and $_.ExtensionData.Adapter -like "*FibreChannel*"} | Select-Object @{N="Name";E={$VMHost.Name}},@{N="Adapter";E={($_.LunPath).Substring(3,33)}},@{N="Target";E={($_.LunPath).Substring(40,33)}},@{N="State";E={$_.State}} 

      }

Dean Grant Blog: deangrant.wordpress.com | Twitter: @dean1609 | GitHub: https://github.com/dean1609
0 Kudos