Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Output DNS Duplicates - Include Name, IP, TimeStamp, RecordType

$
0
0

Hi. I came across this powershell script and would like to modify to include TimeStamp + RecordType values.

I tried adding additional columns. The column headings output but no values so I guess I did it wrong :)

[quote]

# Using WMI, retrieve all the duplicate DNS records


$DNS

=Get-WmiObject-ComputerName'MyServer'`

  

-Namespace'root\MicrosoftDNS'`

  

-ClassMicrosoftDNS_AType`

  

-Filter"ContainerName='MyZone'"|`


Group-Object

OwnerName|Where-Object{$_.Count-gt1}



# Create our CSV file to hold the data


$file

='c:\scripts\DNSDuplicates.csv'


New-Item

-ItemTypefile-Path$file-Force


Add-Content

-Path$file-Value"Name,IPAddress"


# Iterate of the DNS items grabbing the name and IPAddress


foreach

($itemin$DNS) {

   

foreach($IPAddressesin$item.Group) {

       

$value="{0},{1}"-f$item.name,$IPAddresses.IPAddress

       

Add-Content-Path$file-Value$value


    }

}

[/quote]

Can any of you gurus assit?

Kind Regards,

Phil


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>