How to Use getmac Command with Examples

The getmac (short for get MAC address) is a simple Windows network command-line utility used to find the physical address of the network adapters (NIC) in a computer. This tool is typically used in troubleshooting network issues.

The commands shown here are tested on Windows 10 but most will work in other versions of Windows as well. In this article, we will cover the following:


Overview

The getmac is a Windows command-line utility used typically when troubleshooting network issues to retrieve the MAC address, also known as the physical address, of network adapters in a computer. The getmac will only able to retrieve MAC addresses of connected adapters. If an adapter is disabled (in Windows Device Manager for example), or is not connected to the network, getmac will not be able to retrieve its MAC address.

The getmac is not the only way command-line tool to identify the MAC address of a network adapter. The ipconfig utility can also be used for this purpose, along with other functions.


How to Launch Command Prompt

To use this utility, you will need to launch the Command Prompt window. The three common ways to launch the Command Prompt window are:

  1. Search for cmd using the built-in Windows search tool.
  2. Right-click on the Start icon and select Command Prompt.



  3. Press the keyboard combination WinKey + R, then type cmd at the Run window that appears.

    Run cmd


Getmac Syntax

getmac[.exe][/s <computer> [/u <Domain\<User> [/p <Password>]]][/fo {TABLE | list | CSV}][/nh][/v]


Getmac Parameters

Parameter Description
/s system Specifies the remote system to connect to.This can be either an IP address or a host name (do not use backslashes). The default is the local computer.
/u [domain\]user Specifies the user context under which the command should execute. The default is the permissions of the current logged on user on the computer issuing the command.
/p [password] Specifies the password for the given user context. Prompts for input if omitted.
/fo format Specifies the format in which the output is to be displayed. Valid values: "TABLE", "LIST", "CSV". Teh default is Table.
/nh Specifies that the "Column Header" should not be displayed in the output. Valid only for TABLE and CSV formats.
/v Specifies that verbose output is displayed.
/? Displays help information.


Example Usage

There are a variety of switches (sub commands) available with the getmac utility that will alter how it will function. At the most basic, the getmac is used without any switches enabled to displays a the MAC address of all network adapters of a computer.

getmac - Find MAC Address of your Local Computer

To get the MAC address of the network adapters (or NIC for short) in your computer, type the following in the command window then press Enter: getmac

The screenshot example below is the getmac output of a particular computer. The output of your result will differ. In our screenshot example, it shows the MAC address (physical address) of two network adapters.

  • MAC Address #1: 30-5A-3A-7F-17-A1
  • MAC Address #2: 00-FF-49-B8-4F-89

The response "Hardware not present" for the other three adapters indicated that they are currrently disabled.

getmac


getmac /s /u /p - Find MAC Address of a Remote Computer

The getmac utility can also be used to find the MAC address of network adapters on a remote computer. To be able to do this, you will need the following information:

  • The IP address or hostname of the remote computer.
  • Administrator login credential (user name and password) on the remote computer. If the computer is part of a network domain, then you can use your domain administrator credential.

For example, to get the MAC address of a remote computer with a hostname johnpc, using a local administrator username johndoe and password of johnspassword, type the following in the command window then press Enter: getmac /s johnpc /u johndoe /p johnspassword

For example, to get the MAC address of a remote computer with a hostname johnpc, using a network administrator account with username johnadmin and password of mydomainname\johnspassword, type the following in the command window then press Enter:

getmac /s johnpc /u mydomainname\johnadmin /p johnspassword


getmac /fo table /v - Display Result in Table Format with Extra Information

To get the MAC address of the network adapters with the results formatted in a table with extra information, type the following in the command window then press Enter: getmac /fo table /v

As the screenshot example below shows, output shows more information about the adapters.

getmac table format


Other Usages and Getting Help

The example usage described in the article shows only some of the functions available with getmac. To get a list of the available switches, type the following in the command window then press Enter: getmac /?

getmac /?


Tips

Getmac Responses/Errors Explained

  • Hardware Not Present - This indicate the network adapter is disabled, such as from Windows Device Manager.
  • Media Disconnected - This indicate the adapter is not connected to the network (e.g., unplugged from the network).
  • The RPC Server is Unavailable - This typically indicate that the remote device you are using getmac on is not a Windows computer. Using getmac on a remote computer will only work if the remote computer is running a Windows operating system. Thus, using getmac on devices such as printers, network routers, network switch, and Android tablets will not work.
  • Logon Failure: Unknown User Name or Bad Password - This indicate that either the user name and/or password you provided is incorrect. To use getmac on a remote computer, you will need to provide a login credential that is on the remote computer.

Redirect Output to Text File

  • Instead of displaying the results on the screen, you can have the results saved automatically to a text file on your computer. To do this, simply use the ">" symbol followed by the folder path and file name of your choice. For example, to redirect the output of ipconfig /renew, type the following in the command window then press Enter: getmac > c:\temp\getmac-results.txt

    This will create a file named getmac-results.txt in the folder path c:\temp that will have your result. You can then open this file with any text editor, such as Notepad on a Windows computer, as illustrated below.

    getmac redirected output


Summary

The getmac is a simple utility that can come in handy while troubleshooting network issues or to quickly look up MAC addresses. Because of its simplicity, you will likely need to use other tools to effectively troubleshoot moderate to difficult networking issues.


Recommended Reading


Improve confidence and job performance

Improve productivity and efficiency

Learn more,
earn more

Life-long
investment
To learn more about this topic, we are providing you with recommendations to help you further your knowledge. These are our affiliate links to Amazon where you can purchase them and also explore a variety of other relevant books.