Don't use PowerShell. Seriously.

Use nslookup.exe. Wrap it in PowerShell if you want to - but use nslookup 
instead of the various DNS helper libraries.

Regards,

Michael B. Smith
Consultant and Exchange MVP
http://TheEssentialExchange.com


-----Original Message-----
From: Joseph L. Casale [mailto:[email protected]] 
Sent: Thursday, July 07, 2011 8:46 PM
To: NT System Admin Issues
Subject: powershell dns lookup

I need to look up a hostname through one specific server. Looking for a native 
way shows that specifying the server is not trivial.

I found this snippet from 
http://thepowershellguy.com/blogs/posh/archive/2007/04/10/add-extended-dns-support-to-powershell-in-5-minutes.aspx
 :

[System.Reflection.Assembly]::LoadFile( 'D:\Bdev.Net.Dns.dll')
$r = new-Object Bdev.Net.Dns.Request
$q = new-Object Bdev.Net.Dns.Question("foo.example.com",'ANAME','in')
$r.AddQuestion($q)
[Bdev.Net.Dns.Resolver]::Lookup($r,'10.0.0.4') |% {$_.answers}

So what exactly is being output such that every attempt to filter/regex on just 
the record and return only the ip address is failing?
Anyone know a simpler built in way in ps2?

I came across Michaels dns.ps1 from 2007 which is much the same really.

Thanks!
jlc

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to