title: Powershell get particular MAC address in string format
body: <p>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:</p>
  
  <pre><code>$CurrMac = get-netadapter | Where {$_.name -Match "Ethernet 2"}
  $CurrMacAddr = $CurrMac.MacAddress
  out-string -inputobject $CurrMacAddr -outvariable CurrMac2
  $CurrMac2 = $CurrMac2.Substring(0,$CurrMac2.Length-1)
  </code></pre>
  
  <p>So, my question - is there any other way to extract mac address for adapter with name "Ethernet 2" in string without special characters?</p>