I have an issue with my code - I can grab particular MACadress and convert it into string. Problem, is that in my method, it takes some illegal characters:
$CurrMac = get-netadapter | Where {$_.name -Match "Ethernet 2"}
$CurrMacAddr = $CurrMac.MacAddress
out-string -inputobject $CurrMacAddr -outvariable CurrMac2
$CurrMac2 = $CurrMac2.Substring(0,$CurrMac2.Length-1)
So, my question - is there any other way to extract mac address for adapter with name "Ethernet 2" in string without special characters?