[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Can I get the IP address from an known MAC address of my remote PC via Batch file

Posted on 2010-01-01
3
Medium Priority
?
1,036 Views
Last Modified: 2013-12-23
Hi,
Please help me with the error I have made .. and please advice (show) me how can I write a batch file that allow me to obtain the IP address from an known MAC address of my remote PC via Batch file. Thank you very much..

@ECHO OFF

set RemotePC_0001=My_PC

ping -n 1 "%RemotePC_0001%"

arp -a "%RemotePC_0001%                                                    <================= Mistake ?

:: arp -a 192.168.1.34                                                       <=================== It will work ..

nbtstat -a %RemotePC_0001%

PAUSE Please enter to continue ...

======

Pinging My_PC [192.168.1.34] with 32 bytes of data:

Reply from 192.168.1.34: bytes=32 time=38ms TTL=128

Ping statistics for 192.168.1.34:
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 38ms, Maximum = 38ms, Average = 38ms

ARP: bad argument: My_PC                                <============================= Error !!!

Wireless Network Connection:
Node IpAddress: [192.168.1.33] Scope Id: []

    NetBIOS Remote Machine Name Table

    Name               Type         Status
    ---------------------------------------------
    XPS-PC             <00>  UNIQUE      Registered
    THA0001            <00>  GROUP       Registered
    XPS-PC             <20>  UNIQUE      Registered
    THAM0001         <1E>  GROUP      Registered
    THAM0001        <1D>  UNIQUE      Registered
    MSBROWSE__.<01>  GROUP       Registered

    MAC Address = 00-19-0D-30-50-09

Press any key to continue . . .
0
Comment
Question by:cunoc
3 Comments
 
LVL 47

Accepted Solution

by:
Donald Stewart earned 500 total points
ID: 26159155
0
 
LVL 71

Assisted Solution

by:Qlemo
Qlemo earned 500 total points
ID: 26159284
arp needs the IP address to work with. You can retrieve the IP address by many means, one of them is to use the ping answer:

set PCs=My_PC Your_PC
for %%P in (%PCs%) do for /F "tokens=2 delims=[]" %%A in ('ping -n 1 %%P') do (
  if not "%%A" == "" arp -a %%A
  REM and so on
)
0
 

Author Closing Comment

by:cunoc
ID: 31671850
Hi Qlemo and dstewartjr:

Thank you very much for your quick responses and your answers are exactly what I am looking for ...

HAPPY NEW YEAR YOU TWO .. (Qlemo and dstewartjr)
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question