8

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.

gyurisc
  • 11,234
  • 16
  • 68
  • 102

4 Answers4

8
PING -A xxx.xxx.xxx.xxx

This will try WINS and then DNS.

The NSLOOKUP command does similar, but only via DNS.

Jay
  • 56,361
  • 10
  • 99
  • 123
  • @Jay, Is WINS more reliable than the DNS lookup? I have bad experience with DNS – gyurisc Mar 10 '10 at 07:10
  • 1
    This worked for me on Windows 10 if I used the lowercase `ping -a x.x.x.x` syntax. `-A` was not recognized on my machine. – Phlucious Dec 27 '17 at 23:21
5

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.

Jay Zhu
  • 1,636
  • 13
  • 17
2

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.

T.E.D.
  • 44,016
  • 10
  • 73
  • 134
1

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

Malith Ileperuma
  • 926
  • 11
  • 27