Solved

List of Server Names Query for IP

Posted on 2009-07-10
7
326 Views
Last Modified: 2012-05-07
I have a list of approxiamately 300 servers names in an excel spreadsheet that I copied to a test file (one servername per line). I need to run a command or utility that will give me the IP of each server. NSlookup doesnt apear to have a file import function and many of the port scanners only take list of ip to resolve to name. Any ideas?

thanks
0
Comment
Question by:apatrol50
  • 4
  • 3
7 Comments
 
LVL 28

Expert Comment

by:Jan Springer
ID: 24823659
If *nix:

#!/bin/bash

touch <output filename>

cat <input filename> | while read line
 do
   set $line
   host $line >> <output filename>
 done
0
 

Author Comment

by:apatrol50
ID: 24823751
Hi Jesper thanks for the reply. I am not a scripter. How do I package the commands you listed? thanks
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 24823823
Do you have a linux/solaris/hpux/tru64 operating system?  I am not familiar with windows batch commands.

Your other option would be to upload the domain names, I'll run it and upload the results.
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

Author Comment

by:apatrol50
ID: 24823903
No we are all windows and the servers are not public so youwouldnt be able to run the script for me... thanks for the help though
0
 
LVL 28

Expert Comment

by:Jan Springer
ID: 24824042
What about something along the lines of (for a batch file):

for /f "%a" in (filename.txt) do nslookup "%a"
0
 

Author Comment

by:apatrol50
ID: 24839717
Hey Jesper how would you make this statement into a batch? If i save it in a text file and change the exension to .bat and run in a cmd prompt i get an error at the "for" statement
0
 
LVL 28

Accepted Solution

by:
Jan Springer earned 125 total points
ID: 24840344
The filename is whatever.bat.  You run it by typing 'whatever'.

You need to have the input file in the same directory or specify the full path name to the file.

Modify 'MyFilename.txt' and 'Results.txt' to what you would like.

This should work according to all of the batch scripting that I've read:

@echo off
for /F %a in MyFilename.txt do nslookup %a >> Results.txt
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need to find any dns srv records for my lync enviorment 3 56
Places to advertise 6 46
Windows 2012 DNS island on Domain Contoller 2 29
DNS propagation 5 41
I wrote an article (http://www.experts-exchange.com/articles/2245/Anti-rootkit-software.html) some time ago with a reference to nLite  (http://www.nliteos.com/)slipstreaming software.  I recently changed that link to point to NTLite (https://www.ntl…
Resolve DNS query failed errors for Exchange
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

828 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