You are here:   Home Scripts Freeware IPA and IPN command line tools makes scripting of local and remote Name/IP and IP/Name conv
May
20
2007

Freeware IPA and IPN command line tools makes scripting of local and remote Name/IP and IP/Name conv

E-mail
Written by Misha Hanin   

Downloaf IPINFO.ZIP, unzip it, and store IPA.EXE and IPN.EXE in a folder that is in your PATH.

Prior to having these tools, if I wanted to get my local computer's IP address, I would use a FOR command to parse @ping -n 1 %computername%, or Ipconfig /all.

Now, if I want the my computers IP address, I just parse ipa. If I want the IP address of another computer on my network, I just parse ipa [computername]:

for /f "Tokens=*" %%a in ('ipa SomeComputerName') do set IP=%%a

NOTE: Both IPA.EXE and IPN.EXE return ERRORLEVEL 0 upon success, 1 on an error, and 2 on a syntax error.

If I want to return the computer name associated with an IP address on my network, I just parse ipn [IPAdress]:

for /f  "Tokens=*" %%a in ('ipn SomeIPAaddress') do set name=%%a

NOTE: If the network computer is a member of your domain, the format returned is ComputerName.DomainName, like JSI009.JSIINC.COM. If the network computer is NOT a member of your domain, the NetBIOS computer name is returned, like JSI009. If you always want just the NetBIOS computer name:

for /f  "Tokens=1 Delims=." %%a in ('ipn SomeIPAddress') do set name=%%a