Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 201745

Re: Script to output WWN Datacenter Cluster Host

$
0
0

Here is my revised code that gets everything and was checked to work. LucD's works just as well if you want to use his with one caveat that probably won't apply. If you happen to have a host that is not in a cluster (very few cases I'm sure that you would set things up this way) it will not return any results for that host.


$vmhosts = Get-VMHost

$HBAInfo = @()

Foreach ($vmhost in $vmhosts) {

    $HBAs = $vmhost | Get-VMHostHba -Type FibreChannel

    $DC = (Get-Datacenter -VMHost $vmhost).Name

    $Cluster = (Get-Cluster -VMHost $vmhost).Name

    Foreach ($HBA in $HBAs) {

        $Details = "" | Select WWN, WWP, Datacenter, Cluster, Host

        $Details.WWN = "{0:x}" -f $HBA.NodeWorldWideName

        $Details.WWP = "{0:x}" -f $HBA.PortWorldWideName

        $Details.Datacenter = $DC

        $Details.Cluster = $Cluster

        $Details.Host = $vmhost.Name

        $HBAInfo += $Details

    }

}

$HBAInfo


Viewing all articles
Browse latest Browse all 201745

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>