Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 555
  • 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
Who's Defending Your Organization from Threats?

Protecting against advanced threats requires an IT dream team – a well-oiled machine of people and solutions working together to defend your organization. Download our resource kit today to learn more about the tools you need to build you IT Dream Team!

 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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