none
Find IP Address by MAC Address

    Question

  • I have a list of MAC addresses for remote PCs. How to find IP addresses they currently have?
    Friday, June 07, 2013 5:30 PM

Answers

  • i think you can use arp -a then select your mac

    http://stackoverflow.com/questions/4881848/is-there-a-command-in-powershell-to-get-the-ip-information-of-a-mac

    this is untested but i would play with something like this

    $macs = get-content "maclist file"
    foreach($mac in $macs){
    $ip = arp -a | select-string "$mac" |% { $_.ToString().Trim().Split(" ")[0] }
    "$mac has an ip of $ip"
    }


    • Edited by ImMax Friday, June 07, 2013 5:35 PM
    • Marked as answer by Ian3 Tuesday, June 18, 2013 8:58 PM
    Friday, June 07, 2013 5:33 PM
  • nm my last post, just re-read your orignial post, and you need to go the other way lol.......you need arp for this, unless you use my method above and then compare to your list of MAC Addresses

    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.

    Friday, June 07, 2013 6:45 PM
  • nm my last post, just re-read your orignial post, and you need to go the other way lol.......you need arp for this, unless you use my method above and then compare to your list of MAC Addresses

    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.

    This is definitely a good way to fill your arp table and a better suggestion than mine of pinging the broadcast address.

    The way I usually ping an entire subnet is like this:

    1..254 | ForEach { Test-Connection 192.168.0.$_ -Count 1 -Quiet }

    Replace 192.168.0 with the appropriate values for your environment.


    EDIT: This assumes class c.
    Friday, June 07, 2013 11:45 PM

All replies

  • i think you can use arp -a then select your mac

    http://stackoverflow.com/questions/4881848/is-there-a-command-in-powershell-to-get-the-ip-information-of-a-mac

    this is untested but i would play with something like this

    $macs = get-content "maclist file"
    foreach($mac in $macs){
    $ip = arp -a | select-string "$mac" |% { $_.ToString().Trim().Split(" ")[0] }
    "$mac has an ip of $ip"
    }


    • Edited by ImMax Friday, June 07, 2013 5:35 PM
    • Marked as answer by Ian3 Tuesday, June 18, 2013 8:58 PM
    Friday, June 07, 2013 5:33 PM
  • i think you can use arp -a

    http://stackoverflow.com/questions/4881848/is-there-a-command-in-powershell-to-get-the-ip-information-of-a-mac


    This is the method I always use, but just be aware that there will have to be an entry in your arp table for this to return anything useful.
    Friday, June 07, 2013 5:37 PM
  • Also, doesn't arp only work on the current subnet? So if, you are running the comand from a machine on a different subnet, it will not work, unless your router is configured properly for it?

    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.

    Friday, June 07, 2013 5:46 PM
  • what happens if you invoke-command on that remote pc
    Friday, June 07, 2013 5:47 PM
  • Is there anyway to find IP if no entry in local arp table?

    Friday, June 07, 2013 5:49 PM
  • all PCs are on the same subnet.
    Friday, June 07, 2013 5:53 PM
  • Depending on your network setup, you may (repeat, may) be able to send a ping request to the broadcast address and fill your arp table that way.
    Friday, June 07, 2013 5:59 PM
  • Another possiblity is to test connection of every IP on a subnet, then try and use WMI to retrieve the NIC settings of the local machine.

    ForEach ($i in 1..254) { If (Test-Connection 192.168.1.$i -quiet -count 1) { #WMI information here

    $mac = (Get-WMIObject -Class Win32_NetworkAdapterConfiguration -computer 192.168.1.$i | ? { $_.IPEnabled -eq $true }).MACAddress

    Write-Host "Machine: 192.168.1.$i has a MAC Address of $mac"

    } }

    You would obviously have to change the IP portion to what your network address is

    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.




    • Edited by clayman2 Friday, June 07, 2013 6:17 PM
    Friday, June 07, 2013 6:07 PM
  • nm my last post, just re-read your orignial post, and you need to go the other way lol.......you need arp for this, unless you use my method above and then compare to your list of MAC Addresses

    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.

    Friday, June 07, 2013 6:45 PM
  • nm my last post, just re-read your orignial post, and you need to go the other way lol.......you need arp for this, unless you use my method above and then compare to your list of MAC Addresses

    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.

    This is definitely a good way to fill your arp table and a better suggestion than mine of pinging the broadcast address.

    The way I usually ping an entire subnet is like this:

    1..254 | ForEach { Test-Connection 192.168.0.$_ -Count 1 -Quiet }

    Replace 192.168.0 with the appropriate values for your environment.


    EDIT: This assumes class c.
    Friday, June 07, 2013 11:45 PM
  • Hi,

    if remote PCs getting Dynamic IPs thru DHCP then its very easy with NETSH command

    regards,

    Sunday, June 09, 2013 10:46 AM
  • If you have enough control over these machines you could also let them report to a central machine their IP and MAC-addresses (for example via Group Policy: Task Scheduler or startup script, or via WinRM remoting (PowerShell), psexec, something like that).

    Your ultimate goal determines how sane that solution would be I guess.

    Sunday, June 09, 2013 10:52 AM