top of page

PowerShell - Get All Zone Information in DNS

  • Writer: Jon Boyette
    Jon Boyette
  • Jan 25, 2022
  • 1 min read

Save below as a self named .ps1 or copy and paste, this give ALL DNS information with the domain it is ran on, hostname, recordtypes, zonename and data outputs to screen

#

# Get all zone information for a Domain Zone

#

$zone = 'salelytics.local'

Get-DnsServerResourceRecord -Zonename $zone -ComputerName 1150749-dc1 | Select-Object hostname, recordType, @{n='ZoneName';Expression={$zone}},@{n='Data';e={

$rr = $_

switch ($rr.RecordType) {

'A' {$rr.RecordData.IPv4Address}

'CNAME' {$rr.RecordData.HostnameAlias}

'NS' {$rr.RecordData.NameServer}

'SOA' {$rr.RecordData.PrimaryServer}

'SRV' {$rr.RecordData.DomainName}

'PTR' {$rr.RecordData.PtrDomainName}

'MX' {$rr.RecordData.MailExchange}

'AAAA' {$rr.RecordData.IPv6Address}

'TXT' {$rr.RecordData.DescriptiveText}

}

}}


 
 
 

Recent Posts

See All
PowerShell - List All Domain SPNs

Save as same List_ALL_SPNs.ps1 or similar, this LDap calls the Domain for all Service Principal names and accounts related #Build LDAP...

 
 
 
PowerShell - Start-Monitoring

This is a great script used to Monitor and Email if a server is up or down, once ran, and smtp and from address is set, then run:...

 
 
 

Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Boyette Technical Services. Proudly created with Wix.com

bottom of page