PC Review


Reply
Thread Tools Rate Thread

Utility/tool to resolve a list of names

 
 
Vicente Zamora
Guest
Posts: n/a
 
      1st Jun 2006
Does anyone know of a tool or utility that would take in a list of
hostnames and would resolve each one of them to a text file with the IP
addresses? A command line tool would be nice.

I have a list of 500 windows hosts that I need to know their ip
addresses, and typing nslookup, copying and pasting into a spreadsheet
was getting old.

I found a number of utilities that would take in a list of names and
give me all sorts of information about the host (PsInfo from
Sysinternals is one, Dameware is another), but it doesn't give you IP
address.

There are some others that would take in an IP range and resolve them
to hostnames and ping them, then you can export into CSV or text.

Thanks,

Vince

 
Reply With Quote
 
 
 
 
Herb Martin
Guest
Posts: n/a
 
      2nd Jun 2006
Vicente Zamora wrote:
> Does anyone know of a tool or utility that would take in a list of
> hostnames and would resolve each one of them to a text file with the IP
> addresses? A command line tool would be nice.
>
> I have a list of 500 windows hosts that I need to know their ip
> addresses, and typing nslookup, copying and pasting into a spreadsheet
> was getting old.
>
> I found a number of utilities that would take in a list of names and
> give me all sorts of information about the host (PsInfo from
> Sysinternals is one, Dameware is another), but it doesn't give you IP
> address.
>
> There are some others that would take in an IP range and resolve them
> to hostnames and ping them, then you can export into CSV or text.
>
> Thanks,
>
> Vince



Free NMap is a good tool, especially if you don't know all of the names.

Perl can be used to trivially write a program in a few lines to do this
(if you can program at all, or have a programmer.)

As can just using the built-in tools like NSLookup or even Ping to get
the info.

For instance a rough approximation to your request would be:

for /f %a in (names.txt) do ping %a | findstr "Pinging" >>addresses.txt


For the above to work, you would need the names in "names.txt" (one per
line) and you would want to start with no "addresses.txt" file (or an
empty one.)

More advanced versions would strip off the extraneous words and
characters but that is also trivial to do with a text editor and
search and replace.

WARNING: If you make a "batch file" out of the above snippet (rather
than using it directly on the command line manually) then you must
DOUBLE each %-sign in %a (i.e., %%a) -- It's an oddity of batch files
on DOS/Windows.

--
Herb
 
Reply With Quote
 
Vicente Zamora
Guest
Posts: n/a
 
      2nd Jun 2006
That is a great tip, I'll check it out.

What I ended up doing (I'm not totally done yet) is with a VB script I
found that I could plug in to Excel and do the nslookup from Excel.
It's not pretty (especially when recalculating 500 nslookups), but it
gets the job done.

Here's the VB code
http://www.excelforum.com/showthread...hreadid=471818
It's also posted on microsoft.public.excel.programming

Then, just so I could keep manipulating the data, I found a formula to
convert the IP address into decimal, and I use that value to sort by ip
address.

http://www.mvps.org/dmcritchie/excel/sorttcp.htm#tcpn

There's tons of macros and vb scripts to sort and IP address list, but
they can only deal with a single column, and I have several columns
listing Hostname, OS, Service Pack, CPU, Memory, etc, etc, and I need
to keep all columns together.

In any case, I'll look into NMap, looks interesting

Thanks a lot,

Vince


Herb Martin wrote:
> Free NMap is a good tool, especially if you don't know all of the names.
>
> Perl can be used to trivially write a program in a few lines to do this
> (if you can program at all, or have a programmer.)
>
> As can just using the built-in tools like NSLookup or even Ping to get
> the info.
>
> For instance a rough approximation to your request would be:
>
> for /f %a in (names.txt) do ping %a | findstr "Pinging" >>addresses.txt
>
>
> For the above to work, you would need the names in "names.txt" (one per
> line) and you would want to start with no "addresses.txt" file (or an
> empty one.)
>
> More advanced versions would strip off the extraneous words and
> characters but that is also trivial to do with a text editor and
> search and replace.
>
> WARNING: If you make a "batch file" out of the above snippet (rather
> than using it directly on the command line manually) then you must
> DOUBLE each %-sign in %a (i.e., %%a) -- It's an oddity of batch files
> on DOS/Windows.
>
> --
> Herb


 
Reply With Quote
 
Herb Martin
Guest
Posts: n/a
 
      3rd Jun 2006
Vicente Zamora wrote:
> That is a great tip, I'll check it out.


> What I ended up doing (I'm not totally done yet) is with a VB script I
> found that I could plug in to Excel and do the nslookup from Excel.
> It's not pretty (especially when recalculating 500 nslookups), but it
> gets the job done.
>
> Here's the VB code


It was also very nice on your part (goog Netiquette)
to post your own solutions. This way everyone learns.

Pretty doesn't much matter if you will only run this code
once or on rare occasions. If you plan to use it every day
for years then perhaps cleaning it up is worth SOME effort.

The key to small utilities is to keep them simple so that you
can use them in the future.

Many people are (perhaps) surprised to find that even though
I use Perl a LOT, I also use Excel in conjunction with it.

Excel excels at handling tables of data and quickly sorting
and resorting that data. It makes it easy to dump the data
to tab or comma delimited format -- where the more powerful
programming languages (especially) Perl can manipulate the data,
filter it, or restructure it.

Thanks.

--
Herb

> What I ended up doing (I'm not totally done yet) is with a VB script I
> found that I could plug in to Excel and do the nslookup from Excel.
> It's not pretty (especially when recalculating 500 nslookups), but it
> gets the job done.
>
> Here's the VB code
> http://www.excelforum.com/showthread...hreadid=471818
> It's also posted on microsoft.public.excel.programming
>
> Then, just so I could keep manipulating the data, I found a formula to
> convert the IP address into decimal, and I use that value to sort by ip
> address.
>
> http://www.mvps.org/dmcritchie/excel/sorttcp.htm#tcpn
>
> There's tons of macros and vb scripts to sort and IP address list, but
> they can only deal with a single column, and I have several columns
> listing Hostname, OS, Service Pack, CPU, Memory, etc, etc, and I need
> to keep all columns together.
>
> In any case, I'll look into NMap, looks interesting
>
> Thanks a lot,
>
> Vince
>
>
> Herb Martin wrote:
>> Free NMap is a good tool, especially if you don't know all of the names.
>>
>> Perl can be used to trivially write a program in a few lines to do this
>> (if you can program at all, or have a programmer.)
>>
>> As can just using the built-in tools like NSLookup or even Ping to get
>> the info.
>>
>> For instance a rough approximation to your request would be:
>>
>> for /f %a in (names.txt) do ping %a | findstr "Pinging" >>addresses.txt
>>
>>
>> For the above to work, you would need the names in "names.txt" (one per
>> line) and you would want to start with no "addresses.txt" file (or an
>> empty one.)
>>
>> More advanced versions would strip off the extraneous words and
>> characters but that is also trivial to do with a text editor and
>> search and replace.
>>
>> WARNING: If you make a "batch file" out of the above snippet (rather
>> than using it directly on the command line manually) then you must
>> DOUBLE each %-sign in %a (i.e., %%a) -- It's an oddity of batch files
>> on DOS/Windows.
>>
>> --
>> Herb

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IE cannot resolve DNS names Justin G. Mitchell Windows Vista Networking 0 7th Jul 2008 04:09 PM
Resolve names in contacts as well as global address list =?Utf-8?B?TGlhbSBXYXRlcnM=?= Microsoft Outlook Contacts 1 4th May 2006 01:28 PM
Can't resolve DNS names.... =?Utf-8?B?cmljaGFyZGhheQ==?= Windows XP Networking 1 7th Aug 2004 08:21 AM
Cannot resolve names =?Utf-8?B?SmF1bWUgVG9tw6Bz?= Microsoft Windows 2000 DNS 8 13th Apr 2004 04:10 PM
XP cannot resolve names =?Utf-8?B?amFtZXNsaW4xMjM=?= Windows XP Networking 1 12th Jan 2004 03:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:36 PM.