All,
I am running the following command to try and gather all the WWN's for my hosts, but the outputted number does not equal what I have listed for the Emulex of our blades. Any reason this number doesn't seem to match up?
Get-VMHostHBA -type FibreChannel | Select VMHost,Device,PortWorldWideName
The WWN property doesn't display in hex but in decimal.
Try it like this
Get-VMHostHBA -Type FibreChannel | Select VMHost,Device,@{N="WWN";E={"{0:X}" -f $_.PortWorldWideName}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The WWN property doesn't display in hex but in decimal.
Try it like this
Get-VMHostHBA -Type FibreChannel | Select VMHost,Device,@{N="WWN";E={"{0:X}" -f $_.PortWorldWideName}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Found the earlier postings and came up with this:
$hosthba = Get-VMHostHBA -type FibreChannel | Select VMHost,Device,PortWorldWideName
foreach ($hostwwn in $hosthba){
$hostwwn.PortWorldWideName = "{0:x}" -f $hostwwn.PortWorldWideName
}
$hosthba | Sort VMHost,Device | export-csv hbainfo.csv -notypeinformation
Yours is much more elegant than mine as usual!
What is the "{0:x}" -f in your calculated property doing? I see that it's formatting the WWPN in hex, but what is that formatting trick called in Powershell?
Mike, it is a .net formatting technique. Here is a good article that explains it:
http://technet.microsoft.com/en-us/library/ee692795.aspx
0 is the index and x is for hexadecimel.