gyurisc
gyurisc

Reputation: 11502

What is the best way to get the computer name remotely based on an IP address?

I have several windows machines identified by ip address. I would like to write an application that query the computers remotely and gets their name. I cannot rely on DNS because it does not provide exact results.

I heard that there is a NetBIOS API that can be used, but I am not familiar with this API.

Upvotes: 9

Views: 53321

Answers (5)

Mnuel Harry Joseph
Mnuel Harry Joseph

Reputation: 1

tracert 192.168.11.223

Tracing route to TENSEBUSTER2 [192.168.11.223] over a maximum of 30 hops:

1 2 ms <1 ms 1 ms TENSEBUSTER2 [192.168.11.223]

Trace complete.

Upvotes: 0

Jay
Jay

Reputation: 57959

ping -a xxx.xxx.xxx.xxx

This will try WINS and then DNS.

The nslookup command does similar, but only via DNS.

Upvotes: 9

Malith Ileperuma
Malith Ileperuma

Reputation: 994

you can use below command to get youre remote host name using ip address

nslookup [ip address]

or you can use

tracert [ip address]

to track route that that specific ip address

Upvotes: 1

T.E.D.
T.E.D.

Reputation: 44814

This is the exact purpose of RARP or DHCP.

On Windows there is a dll (DHCPobj.dll) available in one of the Microsoft resource kits that supposedly allows you to make queries like this to your local DHCP server. I've never played with it, so I can't say for sure how well it works.

Upvotes: 2

Jay Zhu
Jay Zhu

Reputation: 1672

check getnameinfo

The getnameinfo function provides protocol-independent name resolution from an address to an ANSI host name and from a port number to the ANSI service name.

Upvotes: 4

Related Questions