Add Extended DNS support to PowerShell in 5 minutes
On the PowerShell Community Extensions (PSCX) site , I found this issue : CREATED ISSUE: Need DNS Query that allows DNS server to be specified .
Good that this is discussed and It is great when this functionality get's added to the PSCX project, but as I could not wait and Keith even mentioned where to "steal" this functionality : C# .NET DNS query component on CodeProject.com
I followed the link downloaded the Demo project, loaded DLL into PowerShell, refreshed my tabcompletion to load the new types and followed example in article meanwhile using the PowerShell Gadget to mimic it in PowerShell :
And with 5 minutes I was done :
I really love this PowerGadget it's great I keep it allway's on top at 40 % Opacity , very handy.
If you did not try yet .be sure to check it out !!
here is the code I used for this example :
[System.Reflection.Assembly]::LoadFile( 'C:\dnsposh\Bdev.Net.Dns.dll')
$r = new-Object Bdev.Net.Dns.Request
$q = new-Object Bdev.Net.Dns.Question("www.microsoft.com",'mx','in')
$r.AddQuestion($q)
[Bdev.Net.Dns.Resolver]::Lookup($r,'213.51.129.37') | % {$_.answers}
Another library to add to my profile, it's syntax is a bit developer oriented as I need to irst create the Question object and add it to the Request so some wrapup functions around it could be handy, but still withing 5 minutes I got all functionality in the library at hand in PowerShell.
Enjoy,
Greetings /\/\o\/\/