The command: "getmac" is on Windows 12, 11, 10, .. , MS Server 2025, 2022, 2019, .. available
The examples for the command "getmac"
Here are some examples of using the
`getmac` command in the Windows Command Prompt (cmd):
Example 1: Show all MAC addresses:
getmac
This command displays all physical network adapters on your computer and their associated MAC addresses.
Example 2: Show MAC address for a specific adapter:
getmac /v /fo list /nh /fi "Connection_Name eq Ethernet"
This command displays detailed information for the network adapter named
"Ethernet", including its MAC address. You can adjust the adapter name accordingly.
Example 3: Show only the physical MAC addresses:
getmac /v /fo list /nh | findstr /i "Physical"
This command filters out and displays only the physical MAC addresses.
Example 4: Display MAC address for a remote computer:
getmac /s RemoteComputer /u username /p password
Replace
"RemoteComputer",
"Username" and
"Password" with the appropriate values. This command displays the MAC addresses for network adapters on a remote computer.
Example 5: Show MAC address for all computers on the network:
for /f %i in ('arp -a ^| find "-"') do getmac /s %i
This command loops through all Address Resolution Protocol (ARP) table entries and displays the MAC addresses for the IP addresses found.
Note: Some of the examples may require administrative rights or specific permissions. Make sure you're running Command Prompt as an administrator if necessary and that you have the appropriate access rights.
"getmac" Excerpt from Microsoft Windows Help
Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.
C:\\WINDOWS>
GETMAC [/S system [/U username [/P [password]]]] [/FO format] [/NH] [/V]
Description:
This command line tool enables an administrator to display the MAC
address for one or more network adapters on a system.
Parameter List:
/S system Specifies the remote system to connect to.
/U [domain\]user Specifies the user context under
which the command should execute.
/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".
/V Specifies that the detailed information
should be displayed in the output.
/NH Specifies that the "Column Header" should
not be displayed in the output.
Valid only for TABLE and CSV formats.
/? Displays this help/usage.
Examples:
GETMAC /FO csv
GETMAC /S system /NH /V
GETMAC /S system /U user
GETMAC /S system /U domain\user /P password /FO list /V
GETMAC /S system /U domain\user /P password /FO table /NH
Important information, tips for the "getmac" command
When using the
`getmac` command in the Windows Command Prompt, there are a few points that should be noted:
1.
Admin rights:
Make sure you run Command Prompt as an administrator to have all the necessary permissions for the
`getmac` command. Some information requires elevated privileges.
Right click -> "Run as administrator"
2.
Accuracy of network adapter names:
The correct use of the command depends on the exact spelling of the network adapter name. You can check the available network adapters with
`ipconfig /all`.
3.
Remote Computer Access:
If you want to get the MAC addresses of remote computers, make sure you have the necessary permissions to access those computers. Use the
`/s`,
`/u` and
`/p` options to specify a remote computer, username and password.
getmac /s RemoteComputer /u username /p password
4.
Filtering Information:
You can combine the command with other commands like
`findstr` to show only specific information. Make sure the filters are applied correctly.
getmac /v /fo list /nh | findstr /i "Physical"
5.
Privacy Concerns:
Note that displaying MAC addresses on a network can raise privacy concerns. It is important to ensure that you have permission to access this information and that you handle this data responsibly.
6.
ARP table and network environment:
If you want to view the MAC addresses of all computers on the network, you can use the ARP table. However, note that this method is not always 100% reliable.
for /f %i in ('arp -a ^| find "-"') do getmac /s %i
Be sure to consider these points to ensure that you use the
`getmac` command effectively and responsibly.