Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230613

Convert to MAC address format

$
0
0

I want to convert a set of numbers to the mac address format of 00:00:00:00:00:00.  I've been looking at the .net format operator, but I don't see anything.

If I wanted to convert $a = 'ba2b3cf03b2c' to the same numbers but with the colon in the middle, is there an easy way to do this? ba:2b:3c:f0:3b:2c

 

I tried playing with taking $a and doing this:

 

$a | foreach { $($_[0,1]) -join ''}  That will grab the first 2 characters, and then I was going to play with adding the colon, and through trial and error, getting all the numbers to match, but there may be something a lot easier than that...I'm hoping.


Viewing all articles
Browse latest Browse all 230613

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>