Category filter
Script to get MAC address of Windows devices
Knowing your device’s MAC address is very important as it helps in identifying a specific device from a fleet of devices. It can be used to filter out certain devices from connecting to a specific network or be used to monitor network traffic on a specific device. Since every device has a unique MAC address, it is the best parameter to identify a device and perform actions on it. Hexnode offers a feature where you can fetch the MAC address of a Windows device remotely by executing custom scripts.
Batch Script
Using the ‘ipconfig’ command
1 |
ipconfig /all |
This script displays different parameters of your Windows device’s IP configuration. The Physical Address listed here is the MAC address of your Windows device.
Using the ‘getmac’ command
1 |
getmac |
This script displays the MAC addresses associated with all the active network adapters on your Windows device.
PowerShell Script
The following PowerShell script displays the network MAC address of a Windows device.
1 |
Get-NetAdapter | Select-Object Name, MacAddress |