Created
May 25, 2016 14:54
-
-
Save jangins101/61001526ee976d22f90ab45d0f226925 to your computer and use it in GitHub Desktop.
Grab all the dns zones and their corresponding records and group it by zone name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$computer = $env:USERDNSDOMAIN; | |
# Get all the zones | |
$zones = @(Get-DnsServerZone -ComputerName $computer); | |
# Get records from each zone | |
$results = @{}; | |
ForEach ($zone in $zones) { | |
Write-Host "$($zone.ZoneName)" -ForegroundColor Yellow -NoNewline; | |
$zoneRecords = @($zone | Get-DnsServerResourceRecord -ComputerName $computer); | |
Write-Host " - $($zoneRecords.Count) records" -ForegroundColor Green; | |
$results.Add($zone.ZoneName, $zoneRecords); | |
} | |
$results; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment