header image

Mac Address

Posted by: | November 29, 2013 | No Comment |

No not where you go for a burger!

I saw a post on the forum about getting the MAC address fro remote machines. The original post was using a fixed filter on NetConnectionID which assumes that all of your machines are configured equally. I think a better approach is to gather all the data

function get-macaddress {
[string]$computername = $env:COMPUTERNAME
Get-WmiObject -Class Win32_NetworkAdapter -ComputerName $computername -Filter "NetConnectionID LIKE ‘%’" |
select  PSComputerName, Description, NetConnectionID, MACAddress


The WMI filter ensures that only adapters with a NetConnectionID are returned.

Once you have the data you can ensure your machines are configured the same

under: Networking, PowerShell and WMI