[System.Net.DNS]::GetHostByAddress()
(now [System.Net.DNS]::GetHostEntry()
) doesn't only rely on DNS, despite it's name. It will also check the local C:WindowsSystem32Driversetchosts
file for locally configured entries.
straight dns via nslookup
can't find the name:
PS C:UsersTim> nslookup 192.168.1.50
Server: dns03
Address: 192.168.2.103
*** rpi03 can't find 192.168.1.50: Non-existent domain
yet, gethostentry() still finds the name:
PS C:UsersTim> [system.net.dns]::gethostentry('192.168.1.50')
HostName Aliases AddressList
-------- ------- -----------
localentry {} {192.168.1.50}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…