iTayb
iTayb

Reputation: 12743

convert formatted mac address to an hex value

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?

Upvotes: 1

Views: 1815

Answers (1)

CB.
CB.

Reputation: 60956

this?

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

Edit after comment:

this?

  [UInt64] "0x$("00:0a:fe:25:af:db" -replace ':')"

Upvotes: 2

Related Questions