Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DNS Duplicate Record Script 1

Status
Not open for further replies.

djtech2k

MIS
Jul 24, 2003
1,097
US
I need something that will scan all A records on my DNS server and then identify which IP addresses are used more than once. I am trying to cleanup DNS so that there are NO multiple A-Records for a single IP and use CNAME's instead.

I can query the info from DNS fine, but I am thinking that I will need to use something like a dictionary to find the duplicates. Unfortunately, I am not well versed in the dictionary object. Here is what I have that I am using the query my DNS server:

Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & _
        "\root\MicrosoftDNS")


Set colItems = objWMIService.ExecQuery("Select * from MicrosoftDNS_AType")

For Each objItem in colItems
If objItem.DomainName = "domain.net" Then
wscript.echo objItem.IPAddress & ";" & objItem.OwnerName
End If

Next

Any ideas?

 
That works very similar to what i was doing as well. One thing I do see though is that the time is a bit off. I think it may be a timezone thing. I see DNS timestamps from today that are past my local time (EST). I am guessing that maybe the DNS backend or something in Windows is storing this value in GMT or something and I am adjusting it to EST. Any ideas?
 
The information is stored in GMT....so maybe just change this:
timeStamp = DateAdd("h", objItem.TimeStamp, "1/1/1601 00:00:00 AM")

to this:
timeStamp = DateAdd("h", objItem.TimeStamp - 5, "1/1/1601 00:00:00 AM")


--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Thanks very much to everyone. This is working well so far. I just wish there was more data available for DNS, but this works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top