Tuesday, November 27, 2012

Host and Dig under Windows

Recently I had some DNS problems, I was looking for a Host and Dig command under windows. There is an excellent port that also includes whois command. I totally forgot that under windows there is nslookup (I am getting too old for this). But I figured out that I know how to do it based on system.net library, so I used PowerShell to resolve a host:
[System.Net.Dns]::GetHostAddresses("www.google.com")
I always keep in my memory a public google DNS server.
google public DNS: 8.8.8.8
But unfortunately there is no way for .NET to specify what DNS server use to resolve a host. The reason for that is because DNS.Resolve method relies on the internal Win32 APIs which in turn go through the DNS servers associated with the network connection. In order to change a DNS server one needs to change and configure a network adapter. Ech... I can tell that I am more a developer then admin :)

No comments: