ReneGe
asked on
Batch File: Monitor DNS activities
Hi there,
I need to create a batch file to monitor our Windows Server 2003 DNS server, and all changes are to be displayed within the DOS window.
Thanks for your help,
Rene
I need to create a batch file to monitor our Windows Server 2003 DNS server, and all changes are to be displayed within the DOS window.
Thanks for your help,
Rene
ASKER
Hey Chris,
Monitor Record additions / removals is what I need.
Well, my preference is batch file since I understand it. I do not know VB script (near future learning project).
I'd be happy if, I would get just a command line that will connect to the remote DNS server and give me the list of all DNS records. I'll script the rest, unless you have something.
Thanks,
Rene
Monitor Record additions / removals is what I need.
Well, my preference is batch file since I understand it. I do not know VB script (near future learning project).
I'd be happy if, I would get just a command line that will connect to the remote DNS server and give me the list of all DNS records. I'll script the rest, unless you have something.
Thanks,
Rene
Hmm well if you enable Zone Transfers to whatever server you want to run the script from this will give you a full list:
nslookup
ls -d domain.com
You might find it easier to grab dig:
http://members.shaw.ca/nicholas.fong/dig/
Then use:
dig domain.com axfr
Both perform a zone transfer, and both will give you the full list (SOA repeated twice). Does that help scripting it in batch?
If not, both AD (if AD is involved) and WMI can tell you information about records in zones, useful for the more advanced scripting languages.
Chris
nslookup
ls -d domain.com
You might find it easier to grab dig:
http://members.shaw.ca/nicholas.fong/dig/
Then use:
dig domain.com axfr
Both perform a zone transfer, and both will give you the full list (SOA repeated twice). Does that help scripting it in batch?
If not, both AD (if AD is involved) and WMI can tell you information about records in zones, useful for the more advanced scripting languages.
Chris
ASKER
You you mind giving me the WMIC command line?
It's complex, you have to loop through, one class per record type and you really really need a filter (because that's how you target zones, and avoid the cached records).
So you'd at least want:
MicrosoftDNS_AType
MicrosoftDNS_CNAMEType
MicrosoftDNS_NSType
MicrosoftDNS_SOAType
Then if you use anything beyond the basic, one for each (SRV, MX, and so on).
I'm afraid I can't give you an example, I'm at home, no MS DNS servers here to test against. All are in the Root\MicrosoftDNS namespace if it helps and you want to GET OwnerName and ContainerName (if I remember correctly).
Documentation for the classes is here:
http://msdn.microsoft.com/en-us/library/ms682123%28v=VS.85%29.aspx
Sorry it's not more helpful. If I can convert you to PowerShell you can use my DNS module ;)
Chris
ASKER
I'll give it a try with PowerShell
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Chris,
FYI, I currently have another question for monitoring the DHCP server.
https://www.experts-exchange.com/questions/26983728/Batch-File-Monitor-DHCP-activities.html
Thanks again and cheers,
Rene
FYI, I currently have another question for monitoring the DHCP server.
https://www.experts-exchange.com/questions/26983728/Batch-File-Monitor-DHCP-activities.html
Thanks again and cheers,
Rene
And if you get that far, what kind of changes? Changes to server settings? Record additions / removals?
Chris