Powershell: Create ReverseLookupZones in DNS based on csv

Hey,


I've been creating reverselookupzones manually. Now I want a script to do it for me, based on a csv-file. Can I do that? We have 2008 R2 servers and use powershell 2.0


I'm creating zones, not PTR-records. Thanks Prashant.

When I create a reverse lookup zone manually, this is the configuration:
Zone type: "Primary zone"
Check "Store the zone in active directory"

Active Directory Zone Replication Scope: "To all DNS servers running on domain controllers in this forest: domain.com" (Forest-wide)

Reverse Lookup Zone Name: "IPv4"

Network ID: Import-csv (use csv-file)

Dynamic update: "Allow both nonsecure and secure dynamic updates ..."



I greatly appriciate any help. Be sure to ask if something is unclear.

Is it possible to import the following input?
ReverseLookup
192.168.10.10
192.168.10.11


  • Edited by KoKo__ Monday, December 10, 2012 1:16 PM
November 29th, 2012 5:59pm

Are you creating a Zone or PTR Records in a Reverse lookup Zone?

Thanks,

_Prashant_

Free Windows Admin Tool Kit Click here and download it now
November 29th, 2012 6:20pm

I'm creating a Zone! (more like zones)


I just learned what PTR-records are, or at least where they are. Thanks;)


  • Edited by KoKo__ Thursday, November 29, 2012 3:25 PM
November 29th, 2012 6:24pm

OK ,

I assume you have a CSV File like below

ReverseLookup

=============

1.168.192.in-addr.arpa

1.168.172.in-addr.arpa

.

.

Below is the code

$a = "DNS" #Your DNS Server Name
$b = import-csv C:\Reverselookup.csv | select-object -expand ReverseLookup
Foreach($Reverse in $b)
{
dnscmd $a /zoneadd $Reverse /DSprimary
dnscmd /config $reverse /allowupdate 1
}

CSV File name is REverselookup.csv

Regards,

_Prashant_

Free Windows Admin Tool Kit Click here and download it now
November 30th, 2012 8:22am

Hey,

Thank you very much, this worked as expected! Much appreciated.


Is it possible to have a csv-file with the following, and import that?

ReverseLookup
192.168.10.10
192.168.10.11

November 30th, 2012 1:01pm

No, It requires the data in the same format. As reverse lookup zone has the same format.

If you want to convert this existsing data then my code will help you.

take a look at it

http://gallery.technet.microsoft.com/PowerShell-Script-to-add-A-e878552c

Thanks,

_Pra

Free Windows Admin Tool Kit Click here and download it now
November 30th, 2012 2:26pm

Hi,

i want to create "Reverse Lookup Zone" - Secondary.

can i do it by powershell ?

I tried

Add-DnsServerSecondaryZone -MasterServers 192.168.100.63 -NetworkId 192.168.16

but it says invalid network ID. I tried -NetworkId 192.168.16.0 or -NetworkId 192.168.16. or -NetworkId 192.168.16 but no gain.

it also asks for zonefile name.

can you please guide ?

August 7th, 2014 12:17pm

Hi,

To create reverse DNS look up zone, use the following powershell cmdlet:

Add-DnsServerPrimaryZone -NetworkId "10.x.x.x/8" -ReplicationScope Forest

This command takes network address in the standard format.

Hope this helps.

Thanks, Chetan Arora


Free Windows Admin Tool Kit Click here and download it now
January 30th, 2015 12:41am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics