5
I am using WMI to find out what my WWN (World Wide Name) is for my port on an HBA card. I can get the WWN back but it is contained as an 8 byte array. I would like to convert this byte array into a string of 16 hex digits for easy display.
This is the query I am using to print out each number in its own line. Is there a way to convert this to have the 8 lines combined onto a single line?
gwmi -namespace root\wmi -class MSFC_FibrePortNPIVAttributes | select -expand WWPN | foreach { $_.ToString("X2") }
I think the following can be used to test with just the byte data but I'm still new to PowerShell.
[byte[]] 1,2,3,4,5,6,7,8 | foreach { $_.ToString("X2") }
This lead me down the correct path. I ended up with the following command that does what I need.