How to display an array of bytes in PowerShell as a joined string of hex digits?
Fresh3 days ago
Mar 15, 202616605 viewsConfidence Score0%
0%
Problem
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 it…
Error Output
gwmi -namespace root\wmi -class MSFC_FibrePortNPIVAttributes | select -expand WWPN | foreach { $_.ToString("X2") }Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: How to display an array of bytes in PowerShell as a joined string of hex digits?
Low Risk
Here are a few ways (I'm sure there are others): or or Output for each of the above:
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix