Created
June 7, 2019 13:24
-
-
Save rmbolger/f3bb07015c8905f3b82a81e25e6b78a8 to your computer and use it in GitHub Desktop.
Parses the netlogon.dns file on an Active Directory domain controller to display a nicely formatted and sorted list of required DNS records for that DC
This file contains 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
gc "$($env:SYSTEMROOT)\System32\config\netlogon.dns" | %{ $p = $_.Split(' '); $d = ($p[4..($p.Count-1)] -join ' '); [pscustomobject]@{name=$p[0].Trim('.').Split('.');ttl=$p[1];type=$p[3];data=$d} } | sort @{E={$a=@()+$_.name;[Array]::Reverse($a);$a}},type,data | select @{L='rec';E={$_.name[0]}},@{L='zone';E={$_.name[1..($_.name.Count-1)] -join '.'}},ttl,type,data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment