need a powershell script to add in IP addresses into the DNS zone transfer list

can someone provide a script that we can run to add (2) IP addresses into the DNS server "zone transfer authorized list"

we have 300+ zones to add these IP's on.

many thanks!

Who is Participating?
ChrisConnect With a Mentor Commented:
You can easily do this using dnscmd. The following command should achieve what you're after:

dnscmd SourceServerName /ZoneResetSecondaries ZoneName /SecureList DestinationServerIPs

SourceServerName is the name of the server you're setting the zone transfer settings on.
ZoneName is the name of the zone you're setting the zone transfer settings for.
DestinationServerIPs is a space delimited list of IP address for servers which are allowed to transfer the zone from the source server.
siber1Author Commented:
yes, but I need to do this on 300+ zonenames, which is why I was asking for a script that can accomplish this in bulk.

siber1Author Commented:
I think this may be a way to automate it.
import-csv records.csv | foreach  {dnscmd SourceServerName /ZoneResetSecondaries /ZoneName /SecureList}

Open in new window

siber1Author Commented:
when I run the script directly on the master nameserver [one zonename for testing] I get command failed RPC_s_SERVER_UNAVAILABLE 1722 0X6BA
siber1Author Commented:
figured it out. need to set the variable in the script to $_.ZoneName

works fine now. thx
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.

All Courses

From novice to tech pro — start learning today.