# encoding: ascii
# api: powershell
# title: FC WWN per vendor
# description: Get’s FC adapter WWN’s listed per vendor of ESXi hosts per Cluster
# version: 0.1
# type: script
# author: Leon Scheltema
# license: CC0
# x-poshcode-id: 4893
# x-archived: 2015-05-22T02:52:57
# x-published: 2015-02-12T10:36:00
#
#
# Script to fetch all FC adapter WWN's per Cluster
# By Leon Scheltema AVANCE ICT Groep Nederland

# Begin variables
$VC1 = ""
$cluster = ""
# End variables

# Connect to vCenter server
Connect-VIServer "$VC1"

$scope = Get-VMHost     # All hosts connected in vCenter
$scope = Get-Cluster -Name $cluster | Get-VMHost # All hosts in a specific cluster
foreach ($esx in $scope){
Write-Host "Host:", $esx
$hbas = Get-VMHostHba -VMHost $esx -Type FibreChannel
foreach ($hba in $hbas){
$wwpn = "{0:x}" -f $hba.PortWorldWideName
Write-Host `t $hba.Device, "|", $hba.model, "|", "World Wide Port Name:" $wwpn
}}

# Disconnect from vCenter server
Disconnect-VIServer -server "$VC1" -Force -Confirm:$false
