PowerShell for Windows Admins

Sep 18 2011   8:51AM GMT

DNS cmdlets in PowerShell 3



Posted by: Richard Siddaway
Tags:
DNS
PowerShell 3
Windows 8

There are a number of modules related to DNS

ModuleType Name
———- —-
Manifest DnsClient
Manifest DnsConfig
Binary DnsLookup
Manifest DnsNrpt

If we start with the DnsClient module we get these functions and cmdlets

Add-DnsClientNrptRule
Clear-DNSClientCache
Get-DNSClient
Get-DNSClientCache
Get-DnsClientEffectiveNrptPolicy
Get-DnsClientNrptGlobal
Get-DnsClientNrptRule
Get-DNSGlobalSettings
Get-DNSServerAddress
Remove-DnsClientNrptRule
Set-DNSClient
Set-DnsClientNrptGlobal
Set-DnsClientNrptRule
Set-DNSGlobalSettings
Resolve-DnsName

Knowing which DNS server the client is using

PS> Get-DNSServerAddress | select ElementName, Name

ElementName Name
———– —-
Virtual Wireless 192.168.2.1
isatap.{E962BF88-1194-44A8-B30B-A65A4772C812} 192.168.2.1
Virtual LAN 10.10.54.201
isatap.{EA0AB201-1381-4643-A67D-72C9C8860860} 10.10.54.201
Loopback Pseudo-Interface 1 fec0:0:0:ffff::1
Loopback Pseudo-Interface 1 fec0:0:0:ffff::2
Loopback Pseudo-Interface 1 fec0:0:0:ffff::3

and what the client has cached

Get-DNSClientCache | select Name, data

Name data
—- —-
server02 192.168.2.1
server02 10.10.54.201
server02 192.168.1.6
server02.manticore.org 192.168.2.1
server02.manticore.org 10.10.54.201
server02.manticore.org 192.168.1.6
watson.telemetry.microsoft.com

final one for the moment – is a replacement for nslookup

PS> Resolve-DnsName exch07

IP4Address : 10.10.54.130
Name : exch07.Manticore.org
Type : A
CharacterSet : Unicode
Section : Answer
DataLength : 4
TTL : 1200

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: