banner



How To Get Hostname From Ip

How to get Networked Computer Name from IP Address on a LAN

Please note that this post is over a year old and may contain outdated information.

If you have the local IP address of a computer on your network, and need to get that computer's name, there is an easy method using the ping command in a Windows command prompt.

Command Prompt
Open up a command prompt by typing "cmd" into the start menu search (Windows Vista, 7, or newer) or by opening a Run window and then running "cmd" (Windows XP).

How To Open Windows 7 Command Prompt

Use the following command to ping the local IP address (change xxx.xxx.xxx.xxx to the IP address you want to ping):

ping -a xxx.xxx.xxx.xxx
The -a option of the ping command tells it to resolve the hostname of the IP address, so it will give you the name of the networked computer.

Here is an example of the output for a hypothetical computer named "Office1" that is at local IP address 192.168.1.123:

C:\Users\Username>ping -a 192.168.1.123

Pinging Office1 [192.168.1.123] with 32 bytes of data:
Reply from 192.168.1.123: bytes=32 time<1ms TTL=128
Reply from 192.168.1.123: bytes=32 time<1ms TTL=128
Reply from 192.168.1.123: bytes=32 time<1ms TTL=128
Reply from 192.168.1.123: bytes=32 time<1ms TTL=128

Ping statistics for 192.168.1.123:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Full Network Discovery

If you need to get the hostnames and other information for all of the PCs on your network, I recommend using Advanced IP Scanner.

Comments (31)

John Nov 30, 2020
I am trying this on a domain server and it returns the IP address of whatever I ping, not the computer name. Maybe I am missing something. This is server 2016 and just noticed @gmms comment. Interesting John www.ityoucantrust.com

gmm Jul 27, 2020
server 2016 standard only returned the IP address. what if the host-name in the firewall reads "none" does that mean it is being masked, or there just isn't one?

venkatesh Feb 26, 2020
This command helped me to get the machine name ping -a 10.79.211.182

Anonymous IT Person Feb 12, 2020
This is fantastic! Helped me immensely! Many thx!!

Dominique Feb 04, 2020
Thanks godbless dude

jinner Dec 26, 2019
Thank you very useful.

Ryan Oct 08, 2019
Thanks! This solution worked for me!

Mbiko Ngoma Jul 17, 2019
This worked for me on windows 10 which is connected to a domain thanks a lot

eli Jul 15, 2019
doesnt work in windows 10

Hulk Hogan Batista (Fareportal) May 01, 2019
This is great! I love you guys for helping me. I did not know how to ping or do any of this stuff. I am learning on the field and the ping command is cool. I built a mexico office with my old computers and proud of it. I love you daddy Diane Huff!

Paul Jan 31, 2019
This is great expecially when the DNS cache is out of date. For example today I could not remote into a destination hostname so I used 'ping Office1' which returned an unexpected IP Address then with your help I was able to use ping -a xxx.xxx.xxx.xxx to find a that this is actually a different host 'Office2'. Thg

Stephen Oct 17, 2018
This command worked for me on Windows 7. Oddly nbtstat -a xxx.xxx.xxx.xxx didn't.

Andrie Aug 08, 2018
Thank you very useful!

That Guy Aug 03, 2018
Command does not always work for some devices or on some versions of Windows. Use the following instead, replacing the listed IP with the IP you need to look up: nbtstat -a 192.168.0.0

kadettilac Jun 14, 2018
Awesome, thanks

Hedy May 26, 2018
Thanks...

Tushar more Apr 30, 2018
Thanks

Pavan Amaze Mar 15, 2018
Not Good Answer..

Ritch Mar 07, 2018
Thanks!!

Mavado Mar 07, 2018
Thanks worked like a charm

Sentpaoul Feb 04, 2018
thanks buddy its work

Mo Dec 29, 2017
Thank you

Rory Kelleher Jul 03, 2017
Nice one

Andile Solution-Provider Simelane Jun 06, 2017
That usually when the IP is using Linux OS

Greg Miller Apr 19, 2017
Same

David Fenton Mar 30, 2017
thanks

Sasha Bond Jan 31, 2017
does not work, replies with IP only

Muhammad Tahir Khan Jan 08, 2017
Thanks for command and advice Advanced IP Scanner

Jazmin Aych Jan 14, 2016
Thank you immensly!

How To Get Hostname From Ip

Source: https://www.h3xed.com/windows/how-to-get-networked-computer-name-from-ip-address-lan

Posted by: petersonhinse1964.blogspot.com

0 Response to "How To Get Hostname From Ip"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel