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

I have several windows identified by ip address. I would like to write an application that requests computers remotely and gets its name. I cannot rely on DNS because it does not give exact results.

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

+7
windows ip-address netbios
source share
3 answers

check getnameinfo

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

+5
source share
PING -A xxx.xxx.xxx.xxx 

This will try WINS and then DNS.

The NSLOOKUP command works similarly, but only through DNS.

+7
source share

This is the exact target of RARP or DHCP .

Windows has a DLL (DHCPobj.dll) available in one of Microsoft's resource sets, which supposedly allows you to make such requests on a local DHCP server. I have never played with this, so I can’t say for sure how well it works.

+2
source share

All Articles