If you can export as a CSV then import in to Excel then you can use the conditional formatting to generate a list of duplicates?

http://www.tech-recipes.com/rx/35290/excel-2013-find-duplicate-data-using-conditional-formatting/


I would use nmap to verify all your alive hosts which should clear out the rest of the dead records for you. I would strongly recommend scavenging from this point forward though. Sounds like fun though :)


Here are two scripts (which are almost identical) - one to find duplicate IP and one to find duplicate names.

#region Find duplicate name in dns records
$DupNames = Get-WmiObject -ComputerName 'dc2008' `
   -Namespace 'root\MicrosoftDNS' `
   -Class MicrosoftDNS_AType `
   -Filter "ContainerName='yadsarah.org.il'" | Select-Object RecordData, TimeStamp, OwnerName | `
Group-Object OwnerName | Where-Object {$_.Count -gt 1}

$DupNamesArr = @()
foreach ($RecordGroup in $DupNames) {
    foreach ($Record in $RecordGroup.Group) {
        $RecordObj = New-Object System.Object
        $RecordObj | Add-Member -MemberType NoteProperty -Name 'Name' -Value $Record.OwnerName
        $RecordObj | Add-Member -MemberType NoteProperty -Name 'IPAddress' -Value $Record.RecordData
        $RecordObj | Add-Member -MemberType NoteProperty -Name 'TimeStamp' -Value $Record.TimeStamp
        $DupNamesArr += $RecordObj
    }
}
#endregion

#region Find duplicate IP in dns records
$DupIPs = Get-WmiObject -ComputerName 'dc2008' `
   -Namespace 'root\MicrosoftDNS' `
   -Class MicrosoftDNS_AType `
   -Filter "ContainerName='yadsarah.org.il'" | Select-Object RecordData, TimeStamp, OwnerName | `
Group-Object RecordData | ?{$_.Count -gt 1}

$DupIPArr = @()
foreach ($RecordGroup in $DupIPs) {
    foreach ($Record in $RecordGroup.Group) {

        $RecordObj = New-Object System.Object
        $RecordObj | Add-Member -MemberType NoteProperty -Name 'Name' -Value $Record.OwnerName
        $RecordObj | Add-Member -MemberType NoteProperty -Name 'IPAddress' -Value $Record.RecordData
        $RecordObj | Add-Member -MemberType NoteProperty -Name 'TimeStamp' -Value $Record.TimeStamp
        $DupIPArr += $RecordObj
    }
}
#endregion

Notes:

  1. Some systems (like load balancing) require some duplicate records in order to work properly.

  2. You can add the computer name and IP using WMI, thus verifying the record.

  3. Records with timestamp 0 are static, meaning they were added manually (and are more likely to be important).