We help IT Professionals succeed at work.

Automated NSLOOKUP COMMANDFILE

bigtazz
bigtazz asked
on
Medium Priority
503 Views
Last Modified: 2008-03-06
I am currently trying to create an nslookup.cmd which will run on a number of addresses that are read from a text file.  I want it to have and output file also which logs the successful/unsuccessful nslookups.  Any ideas?  I know this can be easily done with Ping and tracert but I have been having problems with nslookup.
Comment
Watch Question

IT Consultant
Commented:
nslookup is deprecated so will not be supported for ever. The recommended replacements are host and dig. A simple solution is :
create a text file, say  IPs_to_find.txt
some.domain.com
some.domain2.com
some.domain3.com

Then from command line,

dig -f IPs_to_find.txt +short >> ip_log.txt

This will append the short form output of dig to a text file  for all the lookup results  of addresses in IPs_to_find.txt.  Use dig -h to see more options.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.