If your Domain Name System (DNS) is fully integrated with Active Directory, you may have a variance in the assigned TCP/IP addresses and what is in use if there is no accommodation for removed or changed systems. You can use a quick one-liner to export the IP addresses in use by the Windows systems within an Active Directory environment.
For any task relevant to the Windows DNS server, the DNSCMD command is one of the most powerful tools you can use to obtain information. Here is a sample script that will export a particular zone's hosts:
DNSCMD /ZoneExport na.amcs.tld c:fileout.bakThe result will be a flat file, which functions in a similar fashion to the /ZonePrint command but does not have the aging values that make a reconciliation a little more difficult. The entries are exported in alphabetical order, regardless of record type (A, CNAME, etc.), and you can import them into something such as Microsoft Excel quite easily. Once in Excel, you can view and manage the data to compare against your current documentation of IP address assignments (see Figure A). Figure A
There are a handful of lines to this export that start and end the data, but once that is trimmed, the IP addresses and reserved hosts are displayed. Computer accounts that are registered in Active Directory are given the standard DNS A record; any CNAME records that have been created are listed in this file with their target host.
The limitation of this export is that, if the target host is not defined in this zone, this export will not reconcile outward. For example, consider the following CNAME record from the export:
BIZCENTRAL-LIVE 3600 CNAME LINUXSERVER1.ALT-OS.AMCS.TLD
This system, Bizcentral, would be an example of a Linux system that holds some business service. The FQDN of LinuxServer1.Alt-os.amcs.tld would not be included in the export example above. For most Windows server environments, this export will provide a good check for the assigned TCP/IP addresses and what is actually in use.
Miss a Windows Server 2003 tip?
Check out the Windows Server 2003 archive, and catch up on the most useful tips from this newsletter.
Stay on top of the latest Windows Server 2003 and Windows Server 2008 tips and tricks with our free Windows Server newsletter, delivered each Wednesday. Automatically sign up today!
Rick Vanover is a software strategy specialist for Veeam Software, based in Columbus, Ohio. Rick has years of IT experience and focuses on virtualization, Windows-based server administration, and system hardware.