This is a tiny post and I am going to talk about DNS name resolution using using PowerShell. Using this you can resolve hostname to IP address and IP address to hostname. For demonstration purpose, I will use google.com for name resolution.
To resolve a DNS name to IP address:
[System.Net.DNS]::GetHostAddresses("google.com")
Similarly to resolve IP name to DNS name, try the below.
[System.Net.DNS]::GetHostByAddress("1.2.3.4")
This works for internal name resolutions as well. All you need to do is configure your internal DNS server IP address in the network connector properties.
Hope this helps.
Comments on this entry are closed.
Thanks that’s quite simple to lookup. Using Get-DnsServerResourceRecord you have to know the DNS server. This way you don’t.
Ta
Glad I’ve finally found soheimtng I agree with!