• Skip to main content
  • Skip to primary sidebar

Technipages

Smart phone, gadget and computer tutorials

  • Topics
    • Android
    • Gaming
    • Hardware
    • Internet
    • iOS
    • MacOS
    • Office
    • Software
    • Windows
    • Definitions
  • Product Reviews
  • Downloads
  • About

PowerShell: Get Old AD DNS Records

Posted on January 23, 2020 by Mitch Bartlett Leave a Comment

Sometimes Active Directory DNS fails to scavenge properly and delete old DNS records. You can grab a list of records using PowerShell.

Use this example to grab DNS records from the year 2017. Replace “DCName” with the name of a Domain Controller and “ad.yourdomain.com” with your domain name:

Get-DnsServerResourceRecord -ComputerName DCName -ZoneName "ad.yourdomain.com" -RRType "A" | Where {$_.TimeStamp.Year -eq 2017}

This code will show DNS records older than 14 days:

Get-DnsServerResourceRecord -ComputerName DCName -ZoneName "ad.yourdomain.com" -RRType "A" | Where {($_.Timestamp -le (get-date).adddays(-14)) -AND ($_.Timestamp -like "*/*")}

You Might Also Like

  • How to Set PowerShell Execution PolicyHow to Set PowerShell Execution Policy
  • Using PowerShell to Create Azure NSGsUsing PowerShell to Create Azure NSGs
  • 7 Ways to Open PowerShell in Windows 107 Ways to Open PowerShell in Windows 10
  • PowerShell: Check When User Last Set Active Directory PasswordPowerShell: Check When User Last Set Active…
  • Fix "Access to the registry key is denied" Error When Setting Policy For PowerShell ScriptsFix "Access to the registry key is denied" Error…

Filed Under: Windows Tagged With: Active Directory, PowerShell

Reader Interactions

Did this help? Let us know! Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Recent Posts

  • Android 10: How to Adjust the Keyboard Size
  • OneNote Error Code 0xE00001AE – Fix
  • WhatsApp: How to Change Your Phone Number
  • Fix OneNote Error 0xe00001bb: Section Is Corrupted
  • Zoom: How to Show the Unread Message Icon
  • How To Calculate Tips on Android
  • What to Do If Chrome Download Needs Authorization
  • Fix OneNote Error 0xE401065D, 0xE000145C, 0xE4010640

Who’s Behind Technipages?

Baby and Daddy My name is Mitch Bartlett. I've been working in technology for over 20 years in a wide range of tech jobs from Tech Support to Software Testing. I started this site as a technical guide for myself and it has grown into what I hope is a useful reference for all.

Follow me on Twitter, or visit my personal blog.

You May Also Like

© Copyright 2021 Technipages · All Rights Reserved · Privacy