PowerShell DNS Create Conditional Forwarder zone REPACK
LINK ===== https://urlin.us/2twjlY
How to Create a Conditional Forwarder Zone in DNS Using PowerShell
A conditional forwarder zone is a type of DNS zone that allows you to forward queries for specific domain names to other DNS servers. This can be useful when you want to resolve names in a different namespace or network without using stub zones or secondary zones.
In this article, we will show you how to create a conditional forwarder zone in DNS using PowerShell. We will assume that you have already installed the DNS Server role on your Windows Server and that you have the necessary permissions to manage DNS.
Step 1: Create a New Conditional Forwarder Zone Object
The first step is to create a new conditional forwarder zone object using the New-DnsServerConditionalForwarderZone cmdlet. You need to specify the name of the zone, the IP addresses of the DNS servers that will handle the queries for that zone, and optionally some other parameters such as replication scope and description.
For example, to create a conditional forwarder zone for the domain name example.com and forward the queries to the DNS servers 192.168.1.10 and 192.168.1.11, you can use the following command:
New-DnsServerConditionalForwarderZone -Name \"example.com\" -MasterServers 192.168.1.10, 192.168.1.11 -ReplicationScope \"Forest\" -Description \"Forward queries for example.com to external DNS servers\"
This command will create a new conditional forwarder zone object in memory and return it as output. You can verify the properties of the object using the Get-Member cmdlet or by accessing them directly.
Step 2: Add the Conditional Forwarder Zone to the DNS Server
The second step is to add the conditional forwarder zone object to the DNS server using the Add-DnsServerConditionalForwarderZone cmdlet. This cmdlet takes the conditional forwarder zone object as input and adds it to the DNS server configuration.
You can use the pipeline operator () to pass the output of the previous command to this cmdlet, or you can store the object in a variable and use it as input. For example:
New-DnsServerConditionalForwarderZone -Name \"example.com\" -MasterServers 192.168.1.10, 192.168.1.11 -ReplicationScope \"Forest\" -Description \"Forward queries for example.com to external DNS servers\" Add-DnsServerConditionalForwarderZone
or
$zone = New-DnsServerConditionalForwarderZone -Name \"example.com\" -MasterServers 192.168.1.10, 192.168.1.11 -ReplicationScope \"Forest\" -Description \"Forward queries for example.com to external DNS servers\"
Add-DnsServerConditionalForwarderZone -InputObject $zone
This command will add the conditional forwarder zone to the DNS server and return a confirmation message.
Step 3: Test the Conditional Forwarder Zone
The final step is to test the conditional forwarder zone using the Resolve-DnsName cmdlet or any other DNS query tool. You can specify the name of the conditional forwarder zone as the query domain and see if it returns the correct results from the specified DNS servers.
For example, to test the conditional forwarder zone for example.com, you can use the following command:
Resolve-DnsName -Name \"www.example.com\" -Type A -Server localhost
This command will query the local DNS server for the A record of www.example.com and return the result from one of the external DNS servers that are configured in the conditional forwarder zone.
If everything works as expected, you should see something like this:
Name Type TTL Section IPAddress
---- ---- --- ------- ---------
www.example.com A 300 Answer 93.184.216.34 aa16f39245