Link to home
Start Free TrialLog in
Avatar of SAM2009
SAM2009Flag for Canada

asked on

How to get the FQDN of a list of IP servers?

Is there a script which can give the FQDN of servers from a file that contains their IP adr?
Avatar of SterlingMcClung
SterlingMcClung

something like this should work
For /f %L in (file-with-ip-addresses.txt) do ping -a %L

Open in new window

Combine that with some unxutils and you can do:

 
for /f %L in (temp.txt) do @ping -a -n 1 %L | head -n2 | tail -n1 | cut -d" " -f2,3

Open in new window


Hope that works.
Avatar of SAM2009

ASKER

Is it in vbs?
Sorry, no.  This is just a command line.  Run it from a command prompt or place in it a .bat/.cmd file.
The head, tail and cut commands are not built into windows, but are very useful tools from Unix.  Many of these useful programs have been ported to native Windows applications in the unxutils project at sourceforge.  You can obtain them from:

http://unxutils.sourceforge.net/

I tend to put these in a bin folder in my C:\ on all of my computers and add the directory to the systemwide Path variable.  They are very useful in solving problems like this.
Avatar of SAM2009

ASKER

With that cmd NS LOOKUP ZONE should be added in DNS right to get a result?
ASKER CERTIFIED SOLUTION
Avatar of SterlingMcClung
SterlingMcClung

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SAM2009

ASKER

Thank you for the explanation and help!