user770022
user770022

Reputation: 2959

Is there a command in powershell to get the IP information of a MAC

I am wanting to have a simple command to resolve a MAC address to an IP. Is this even possible? I know the MAC address I am looking to get the IP address.

Upvotes: 9

Views: 36782

Answers (3)

Xavier Poinas
Xavier Poinas

Reputation: 19743

This will give if the IP address if you already have the MAC/IP association in your ARP table:

arp -a | select-string "00-1c-87-c0-1c-5d" |% { $_.ToString().Trim().Split(" ")[0] }

returns

192.168.10.95

If you do not have the record in your ARP table, then I don't think that there is an easy way to do it.

One way would be to install arping and call it in a similar fashion from your Powershell script.

Upvotes: 9

Abhyudaya Sharma
Abhyudaya Sharma

Reputation: 1292

The Get-NetNeighbor allows you to get the IP addresses from the MAC addresses if present in the ARP cache. For example:

Get-NetNeighbor -LinkLayerAddress ff-ff-ff-ff-ff-ff

will list all IP addresses with the MAC address equal to FF-FF-FF-FF-FF-FF.

Upvotes: 5

kelloti
kelloti

Reputation: 8951

This link describes how to use arp on the command line to do this. You might also be able to use the Win32_NetworkAdapterConfiguration WMI object to do this straight from PowerShell.

Upvotes: 0

Related Questions