Reply to Message

View discussion in a popup

Replying to:
kunaludapi
Expert
Expert

You are getting IP addresses in VMhost because they are added to vCenter by IP addresses not FQDN. Below script should provide you desired results. (only the The bold highlighted area has been replaced, Other code is as it is.)

$dcName = "MyDatacenter"

$clusterName = "MyCluster"

$list = Get-Datacenter -Name $dcName | % {

  $datacenter=$_

  $datacenter | Get-Cluster -Name $clusterName | %{

    $cluster = $_

    Get-VMhost -Location $cluster | Get-VMHostHBA -Type FibreChannel | where {$_.Status -eq "online"} |

      Select @{N="Datacenter";E={$datacenter}},

        @{N="Cluster";E={$cluster}},

        @{N="VMHost";E={$($_.VMHost | Get-VMHostNetwork).HostName}},

        Device,Status,

        @{N="WWN";E={((("{0:X}"-f $_.PortWorldWideName).ToLower()) -replace "(\w{2})",'$1:').TrimEnd(':')}}

    }

}

#Output CSV to current directory.

$list | export-csv -NoTypeInformation C:\output.csv

--------------------------------------------------------------- Kunal Udapi Sr. System Architect (Virtualization, Networking And Storage) http://vcloud-lab.com http://kunaludapi.blogspot.com VMWare vExpert 2014, 2015, 2016 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".