Question

I have a mac address as a string in the following format: xx:xx:xx:xx:xx:xx (six groups of two hexadecimal digits, separated by colons).

I want to convert the string into it's respective hex value (as a System.Byte type).

How can I convert it?

Was it helpful?

Solution

this?

 "00:0a:fe:25:af:db" -split ':' | % { [byte]"0x$_" }

Edit after comment:

this?

  [UInt64] "0x$("00:0a:fe:25:af:db" -replace ':')"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top