Blog Post

Core Infrastructure and Security Blog
1 MIN READ

Mailbag: DNS Aging and Scavenging (Getting the DNS Record Timestamp) w/ Windows Server 2012 cmdlets

BrandonWilson's avatar
BrandonWilson
Icon for Microsoft rankMicrosoft
Sep 19, 2018

First published on TechNet on Apr 05, 2013

 

Greg here with a quick post where the new DNS PowerShell cmdlets in AD made a task much easier.

 

Many of our customers use Microsoft DNS and a feature of Microsoft DNS is the ability to remove stale records. By default this feature is disabled and some people never enable it, and others disable it believing it has deleted something it should not. Then years later they find they have 1000s of stale records and want to clean up this situation. The problem with our traditional cmd line tool DNSCMD is that it does not output the timestamp in a friendly readable format. There are other blog posts out there with scripts that sometimes work and sometimes we go onsite to help. Now we have a PowerShell cmdlet that will easily get this information for you. You do not need a Windows Server 2012 DC or DNS server you just need a Windows 8 or Windows Server 2012 machine with the new DNS cmdlets.

 

Get-DnsServerResourceRecord -ZoneName "demo.local" -RRType "A" | Export-Csv demo.csv

 

That one liner will output all of the A records from a zone called demo.local and give us a file we can easily put in Excel to review these records.

 

If you are not familiar with DNS aging and scavenging we have plenty of documentation around this.

http://technet.microsoft.com/en-us/library/cc759204(WS.10).aspx

 

Windows Server 2012 DNS PowerShell cmdlets

http://technet.microsoft.com/en-us/library/jj649850.aspx

 

Greg

 

Updated Feb 19, 2020
Version 4.0
No CommentsBe the first to comment

Share