Tuesday, July 9, 2013

vmware powercli Script to get the wwn of esxi5.x host in cluster

To get the all the wwn of the host in cluster use the below simple script.

#Input Cluster
$cluster = Read-Host "Enter Cluster name"
#will fetch the list of host in the cluster
$esxi = get-cluster -name $cluster | get-vmhost
#will get the wwn of host in the cluster,
Get-VMHostHba -VMHost $esxi| Select VMHost,Device,@{N="WWN";E={"{0:X}" -f $_.PortWorldWideName}}

copy this to a notepad and Save this as script_wwn.ps1 to any location and point to the location from  vmware powercli console and run the script , as follows.

it will ask for cluster name, enter the cluster name and output will be as follows;

VMHost                                            Device                                            WWN
------                                            ------                                            ---
ESX01                                       vmhba0                                            218000E08B000186
ESX01                                       vmhba1                                            218100E08B200186

No comments:

Post a Comment