PowerShell: Get MAC Address
Network inventory, MAC-based filtering, or troubleshooting a NIC issue - this one-liner pulls the MAC address for every network adapter on the machine in one go.
Prerequisites:
- Privileges: None
- Module: Built-in, no import needed
Quick Command:
Get-CimInstance -ClassName Win32_NetworkAdapter | Select-Object Name, MACAddress, NetEnabled
Example Output:
Name MACAddress NetEnabled
---- ---------- ----------
Wi-Fi 00-1A-2B-3C-4D-5E False
Ethernet 00-1A-2B-3C-4D-5F True
📦
Want all of them at once?
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
How It Works:
- Get-CimInstance Win32_NetworkAdapter queries all network adapters recognized by the system through the classic WMI class, including their configuration and hardware details.
- Name identifies the adapter, so you can tell which interface each MAC address belongs to.
- MacAddress shows the physical hardware address burned into the adapter - this stays the same regardless of IP configuration or network changes.
- NetEnabled shows whether the adapter is active (True) or not (False), which helps you spot the interface actually in use versus ones sitting idle.
- Select-Object trims the output down to just these three properties, since Win32_NetworkAdapter also returns a lot more data (like Speed, AdapterType, or Manufacturer) that isn't needed for a quick MAC lookup.
Pro Tip:
On newer systems, there's a cleaner purpose-built alternative - readable status instead of true/false, and short friendly adapter names. Great for quick local lookups; stick with CIM for older systems or remoting.
Quick Command:
Get-NetAdapter | Select-Object Name, MacAddress, Status
Example Output:
Name MacAddress Status
---- ---------- ------
Wi-Fi 00-1A-2B-3C-4D-5E Disconnected
Ethernet 00-1A-2B-3C-4D-5F Up