An automated script which can get the mac address from a file of ip's

bsharath
bsharath used Ask the Experts™
on
Hi,

I have a file in which have some ip address i need a script which can take the ip address from the file and give me the mac address of the ip realted machines.

Regards
Sharath
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2007

Commented:
         Hi Sharath
             for /f %x in (c:\ips.txt) do psexec \\%x ipconfig /all >> result.txt

This will bring all ip,gateway,dns and MAC addresses in specified client.

Regards

Author

Commented:
Can i have a bat file which can give me the exact detail that i want.
Mac address and machine name

I tried this but no results to the file results.Its empty
Top Expert 2007

Commented:
       Hi Sharath
            *Nothing looks wrong with script. It should write output to result.txt. Would you please try without >> result.txt and see if it brings MAC also Computer name info.

Regards
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Most Valuable Expert 2011
Top Expert 2011

Commented:
Start the script from the psexec directory...
Systems Engineer
Top Expert 2007
Commented:
Hi Sharath,
You can use following script. It does not require any external command / tool.
This script require IPS.txt file at C: drive root and will generate Macs.txt file C: drive root.
Hope it will help.

@Echo Off
@Echo. >C:\Macs.txt
FOR /F %%c IN (C:\IPS.txt) Do (
      @Echo Detail of: %%c                                   >>C:\Macs.txt
      NBTStat -A %%c | FIND "<00>"                      >>C:\Macs.txt
      NBTStat -A %%c | FIND "MAC Address"       >>C:\Macs.txt
      @Echo -----------------------------------------    >>C:\Macs.txt
)
Farhan KaziSystems Engineer
Top Expert 2007

Commented:
Copy and paste above script in notepad and save it with .bat extension.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial