Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can i get the total records in my DNS Server (Windows Server 2003 - Active Directory Environment)

Is it possible to get this information via Powershell/wmi ?


So far i used this with Powershell:

& "d:\AdminTools\SupportTools\Windows2003\dnscmd.exe" SERVERDNS /enumrecords domain.local . > output.txt
gc output.txt | measure-object | select count

Any suggestions ?

share|improve this question
Are you looking just for a total count or do you want to enumerate all records? Also, you looking for just a zone or for everything on the entire server? – squillman Jan 27 '10 at 18:45
I want the total count for a specific zone – Xavier C Feb 10 '10 at 13:41
up vote 0 down vote accepted

How about a simple batch file...

@Echo Off
rem Enter the location of the Windows Support Tools below
set @SupportToolsLoc=c:\Program Files\Support Tools

rem Enter the domain name you want to count below

rem Enter DNS Server Name below, or a period for the local server
Set @DNSServer=.

set /a @RecordCount=0
"%@SupportToolsLoc%\dnscmd" %@DNSServer% /enumrecords %@DomainName% . >DNSRecords.txt
for /f "skip=1 tokens=*" %%f in ('type DNSRecords.txt') do set /a @RecordCount=!@RecordCount! + 1
set /a @RecordCount=!@RecordCount! - 1
If "%@DNSServer%"=="." echo There are !@RecordCount! records in the domain %@DomainName% on the local server
If not "%@DNSServer%"=="." echo There are !@RecordCount! records in the domain %@DomainName% on the DNS Server %@DNSServer%
del /q DNSRecords.txt

Hope this helps,


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.