PDA

View Full Version : Get the computer name using the IP address


Tek
08-08-2005, 02:27 PM
Hi everyone,

I am working on a custom project using AMS and I need to find an easy and reliable way of retrieving a computer name using its IP address.

The application I am making scans the local network to make backups of software configurations for our customers.

I have tried with 'nbtstat.exe' in Windows but this can get messy when I'm trying to get the information from the output.

The command/code/external program only needs to work for Windows 2000/XP. You can also assume that the workstation that this is being run from has Administrative privileges to the target workstation, so using some registry key retrieval method is ok by me.

If anyone has any ideas, or if someone can write a simple application to do this (and say write it out to a text file) it would be much appreciated. :)

Thanks.

Worm
08-08-2005, 02:35 PM
Take a look here...

http://www.indigorose.com/forums/showpost.php?p=52433&postcount=5

Tek
08-08-2005, 03:12 PM
Nice little DLL there. I can see uses for that in other scenarios...

But is there something I can get that can be passed a value, like:

getname 192.168.2.171

would produce a result (or a file with a result) with just the computer name? I just need it to get the result for one workstation at a time.

Thanks for the reply. :yes

Worm
08-08-2005, 08:17 PM
Same DLL, different function :)

If I didn't mention it, this has to be on a NT (Servered) network to work.

Tek
08-09-2005, 01:53 PM
Cool thanks Worm. :)

I'll give this a go within the next day or so and let you know how it goes.

As always, many thanks. :yes :yes