• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 557
  • Last Modified:

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
0
ReneGe
Asked:
ReneGe
  • 4
  • 4
1 Solution
 
Chris DentPowerShell DeveloperCommented:
Do you have any flexibility in that? What you ask is hard enough in a decent scripting language, the batch requirement (if it is a requirement) makes it obscene.

And if you get that far, what kind of changes? Changes to server settings? Record additions / removals?

Chris
0
 
ReneGeAuthor Commented:
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


0
 
Chris DentPowerShell DeveloperCommented:
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
0
Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

 
ReneGeAuthor Commented:
You you mind giving me the WMIC command line?
0
 
Chris DentPowerShell DeveloperCommented:

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
0
 
ReneGeAuthor Commented:
I'll give it a try with PowerShell
0
 
Chris DentPowerShell DeveloperCommented:
This is my module, it can do all the slightly harder stuff for you:

http://dnsshell.codeplex.com/

Although it's work in progress it should be happy dealing with the record query for you.

Chris
0
 
ReneGeAuthor Commented:
Thanks Chris,

FYI, I currently have another question for monitoring the DHCP server.

http://www.experts-exchange.com/Networking/Protocols/DHCP/Q_26983728.html

Thanks again and cheers,
Rene
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now