JSI Tip 9598. Freeware IPA and IPN command line tools makes scripting of local and remote Name/IP and IP/Name conversion easier.

Jerold Schulman

July 26, 2005

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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

NOTE: I discarded the IPINFO.EXE GUI.

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



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like