You can find the MAC address of all the network cards or network adapters using Powershell. Powershell offers quick and concise methods or directives to find the MAC address of network adapters. Below, we take a look at various Powershell directives that can be used to find the MAC address of a local or remote computer.
Before sharing the exact command, we would like to reiterate that you need to launch a Powershell session to use the Powershell directives shared below. You can launch the Powershell session on a Windows 11 computer using the ‘pwsh’ command. You can put this command in the command prompt on a Windows 11 computer. Or, you could put in the ‘pwsh’ command directly into the search bar on the Windows 11 computer.
The screenshot below shows the ‘pwsh’ command in the search box on a Windows 11 computer. You will need to run pwsh as an administrator.
Now, we will look at four different ways in which we can find the MAC addresses of all the network cards on a Windows computer.
Using Get-Netadapter to find MAC address on a Windows computer
The simplest, quickest, and fastest way to fetch MAC address details of the network adapters on a Windows computer has to be through the Get-NetAdapter cmdlet in Powershell. The command that can be used to fetch the MAC address of all the network cards on a Windows computer is mentioned below.
Get-NetAdapter | Select Name, MacAddress
The Get-NetAdapter cmdlet shares comprehensive details about the network cards on the computer. We have qualified the output of the cmdlet to only include the name of the network card and the corresponding MAC address of each network card.
The command output of this cmdlet is displayed below in the form of a screenshot.
The Get-NetAdapter directive displays the mac address of each and every network card of a Windows computer or server. This cmdlet is one of the simplest and easiest ways to fetch the mac address details of the network cards on the Windows computer.
Using Getmac directive to find MAC address in Powershell
An alternate approach to finding the MAC address of a Windows computer in Powershell is through the ‘Getmac’ Powershell cmdlet. The following Getmac cmdlet can be used in the Powershell session to find MAC address of all the network cards in the computer.
getmac /fo table /v
The output of this Powershell cmdlet can be seen below in the screenshot. You can see that we get a list of all the network cards with the corresponding MAC addresses of each and every network card.
The output of the Getmac Powershell directive has been formatted in table format for ease of reading and clarity of the output.
You can use Getmac to fetch the MAC addresses of network cards on a local computer. For remote computers, we always suggest using the PSExec Powershell directives to create a remote session and then using the cmdlet as you would on a local Windows computer.
Using WMI Object to fetch MAC address in Powershell
Apart from using Get-NetAdapter and Getmac command directives, you can also use the WMIObject to find MAC addresses on a Windows computer. The WMI Object will work on the win32_networkadapterconfiguration class to get the MAC address on Windows computer using Powershell commands.
The WMI Object command to find the MAC address of network cards on a Windows computer is given below:
Get-WmiObject win32_networkadapterconfiguration | select description, macaddress
The command output of this command is given below as a screenshot. You can see that the MAC addresses of physical network cards and all the logical or virtual network cards of a Windows computer are shared in the command output.
Similar to the WMI Object, we can find the MAC address of all the network cards on a Windows computer using the CIM Instance Powershell directives.
Find MAC address using CIM Instance in Powershell
The CIM Instance directive uses the win32_networkadapterconfiguration class to get MAC addresses of all the network cards of a Windows computer. The command is shared below for your ready reference.
Get-CimInstance win32_networkadapterconfiguration | select description, macaddress
The output of this command is similar to the output of the WMI Object command. The command output is shared below in the form of a screenshot.
In this Powershell tutorial, we have shared four different command directives of Powershell that can get all the MAC addresses of the network cards of the computer. The WMI Object and CIM Instance Powershell commands also provide the MAC addresses of the virtual network cards of the computer.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?
Rajesh Dhawan is a technology professional who loves to blog about smart wearables, Cloud computing and Microsoft technologies. He loves to break complex problems into manageable chunks of meaningful information.