How to get correct IP address with computer name?
Hi,
I have problem querying the correct IP address with computer name in the
following scenario:
Two computers (Windows XP SP2 professional) involved:
IP addresses are managed by DHCP Server.
name IP
ComputerA 149.245.176.170
ComputerB 149.245.176.194
ping ComputerA on ComputerB, I get 149.245.176.170, it is correct.
Switch ComputerA to another network, then it is assigned 149.245.179.175.
Again I ping ComputerA on ComputerB, I still get 149.245.176.170 and
timeout.
I also tried \Microsoft SDK\Samples\netds\DNS\DNSQuery sample, but it
returns error code 9003 on ComputerB.
Although I can't find ComputerA by DNS query, file sharing is still working,
ie, I can access \\ComputerA.
How can explorer.exe find the right machine when DNS does not work? Can I
implement the same feature?
I hope I have made my problem clear.
I have tried "MicrosoftDNS_WINSRType" and got "0x8004100E" error at the
second line.
strComputer = "."
Set objWMIService = GetObject ("winmgmts:\\" & strComputer &
"\root\MicrosoftDNS")
I want to get IP address of ComputerA on ComputerB programmatically, no
matter via WINS, DNS, DHCP, ADSI, WMI or something else.
Thanks a lot for your attention.
date: Thu, 6 Apr 2006 16:22:15 +0800
author: www.fruitfruit.com