Solved

List of Server Names Query for IP

Posted on 2009-07-10
7
323 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Good afternoon all, We are running a VM infrastructure on a clustered ESX environment with two DELL R710's.  One of our IT Application Support Engineers contacted me and asked if it was possible to extend the partition of a certain Windows 2003 S…
In this article we have discussed the manual scenarios to recover data from Windows 10 through some backup and recovery tools which are offered by it.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

861 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now