• Skip to main content
  • Skip to primary sidebar

Technipages

Tutorials and fixes for smartphone, gadget, and computer problems

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

PowerShell: Get Old AD DNS Records

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 Policy
    How to Set PowerShell Execution Policy
  • Fix: Windows Cannot Find Powershell.exe
    Fix: Windows Cannot Find Powershell.exe
  • 7 Ways to Open PowerShell in Windows 10
    7 Ways to Open PowerShell in Windows 10
  • Using PowerShell to Create Azure NSGs
    Using PowerShell to Create Azure NSGs
  • How to Remove Windows 10 Bloatware With PowerShell
    How to Remove Windows 10 Bloatware With PowerShell
  • Fix: PowerShell.exe Is Not a Microsoft-Verified Application
    Fix: PowerShell.exe Is Not a Microsoft-Verified Application
  • Teams: Manage External Access With PowerShell
    Teams: Manage External Access With PowerShell
  • PowerShell: Check When User Last Set Active Directory Password
    PowerShell: Check When User Last Set Active Directory…
  • Fix "Access to the registry key is denied" Error When Setting Policy For PowerShell Scripts
    Fix "Access to the registry key is denied" Error When…

Filed Under: Windows Tagged With: Active Directory, PowerShell

Reader Interactions

Did this help? Let us know!

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

  • What Is Host Memory Buffer (HMB) in SSD?
  • DRAM on an SSD: Is It Something You want?
  • 5 Free Android Apps to Remove Red Eye
  • Windows 11: How to Change the Primary Mouse Button
  • Windows 11: Use Fonts and Make Your Text Fantastic
  • Windows 11: How to Manage the Recycling Bin
  • How to Enable Dark Mode in Firefox
  • Windows 11: How to Add Clocks with Different Time Zones

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.

© Copyright 2022 Technipages · All Rights Reserved · Privacy