Managing Standard and DNS Conditional Forwarder with PowerShell


The Best WordPress plugins!

1. WP Reset

2. WP 301 Redirects

3. WP Force SSL

The article discusses a typical scenario of managing your standard and DNS Conditional Forwarders using PowerShell. The introduction is brief, but gives the reader an idea on what this process entails.

The “get conditional forwarder powershell” is a PowerShell command that allows users to manage their Standard and DNS Conditional Forwarders.

Managing Standard and DNS Conditional Forwarder with PowerShell

Conditional DNS Forwarders and Windows DNS forwarders are critical components of your DNS infrastructure. We’ll go through AD DNS forwarders and how to handle them in your environment in this tutorial.

You’ll need to add or modify these forwarder addresses from time to time. Some of these adjustments may need to be performed on several DNS servers around your company. Thankfully, you can handle both of these DNS services with ease using commands like PowerShell’s Set-DnsServerForwarder cmdlet and others.

David Lamb, a TechSnips contributor, developed a video to accompany this blog entry. Feel free to look at your watch or continue reading if you prefer text.

DNS Forwarders Replacement

A DNS server uses DNS forwarders to search requests for addresses that aren’t found in any of the server’s authoritative zones. This gives your DNS servers a quick and easy way to resolve names. Your DNS server would have to query the root hint servers to start resolving unknown addresses if the forwarders were not in place.

While each DNS server’s forwarder addresses must be established independently, PowerShell makes handling them much simpler using the Set-DnsServerForwarder cmdlet.

Start by looking at the forwarders that are presently set for the local DNS server. We’ll use the Get-DnsServerForwarder cmdlet to do this. We’re starting with the Get-* cmdlet since you need to discover all existing forwarders first.

There are two forwarders set with IP addresses of and, as shown below.

PS> Get-DnsServerForwarder

Locating DNS server forwarders that already existLocating DNS server forwarders that already exist

Now you may add another forwarder. This forwarder might be a new DNS server you’ve set up in our DMZ, or it could be a forwarding address given by our ISP. In this situation, you’ll establish the new address with Set-DnsServerForwarder and then verify it with Get-DnsServerForwarder.

Get-DnsServerForwarder Set-DnsServerForwarder

Change in DNS server forwarder confirmedChange in DNS server forwarder confirmed

Unfortunately, this did not turn out as planned. As you can see from the example above, the Set-DnsServerForwarder cmdlet replaces rather than adds to the list of forwarders. You must use Add-DnsServerForwarder to add the address to the list rather than replacing the whole list.

Replace the original two forwarders on the list, add the new address, and check to see whether you were successful., Set-DnsServerForwarder -IPAddress -IPAddress Add-DnsServerForwarder Get-DnsServerForwarder

Addition of DNS server forwarder confirmedAddition of DNS server forwarder confirmed

You’ve now added all three forwarders.

DNS Forwarders Are Removed

If you wish to get rid of a forwarder address, use the Remove-DnsServerForwarder cmdlet, as shown below. You’d then check to see whether the address had been changed.

Remove-DnsServerForwarder removes the DNS forwarder altogether if Set-DnsServerForwarder replaces it.

Get-DnsServerForwarder -IPAddress Remove-DnsServerForwarder -IPAddress

Confirming the removal of DNS server forwardersConfirming the removal of DNS server forwarders

Multiple DNS Servers Scaling

You may need to add or delete a forwarder address on various DNS servers at times. Set-DnsServerForwarder will not function in this case. Fortunately, PowerShell makes expanding this job to many DNS servers a breeze. You can adjust all of our DNS servers with a single command if you use Invoke-Command and include a list of all of our DNS servers, then add Add-DnsServerForwarder to the scriptblock argument value. View the effects of our adjustments with a similar command.

Add-DnsServerForwarder -IPAddress -ScriptBlock Invoke-Command -ComputerName DC01, DC02, DC03 -ScriptBlock Get-DnsServerForwarder Invoke-Command -ComputerName DC01, DC02, DC03 -ScriptBlock

Using multiple DNS servers to add DNS server forwardersUsing multiple DNS servers to add DNS server forwarders

Conditional DNS Forwarders

The Set-DnsServerForwarder cmdlet can’t change a conditional forwarder, which is a specific sort of forwarder. When you’ve been given the IP address(es) of the DNS server(s) for a known DNS domain name, you may utilize this sort of forwarder.

Conditional DNS Forwarders are used by the DNS server before using the server forwarders listed earlier in this article.

If you have a conditional forwarder set for, for example, your DNS server will check the conditional forwarders after making sure it isn’t a name it is authoritative for. At this stage, your DNS server contacts the DNS server for the domain’s intended address.

One nice feature of Conditional DNS Forwarders is that they can be replicated to other DNS servers in the same way that any Active Directory Integrated DNS Zone can be.

Start by using the Get-DnsServerZone cmdlet to discover whether you have a conditional forwarder setup.

Identifying DNS ZonesIdentifying DNS Zones

With a ZoneType of forwarder, conditional forwarders appear in this list. We don’t have one setup in this circumstance. To construct the conditional forwarder, run Add-DnsServerConditionalForwarderZone, configure it to replicate to the whole Active Directory forest, and then validate its creation.

PS> Add-DnsServerConditionalForwarderZone ` -Name ` -MasterServers, ` -ReplicationScope Forest PS> Get-DnsServerZone

New DNS server conditional forwarder zone verificationNew DNS server conditional forwarder zone verification

The result indicates that our conditional forwarder is setup and ready to use.


Managing DNS forwarders is a breeze using PowerShell! You should now be able to control and automate AD DNS forwarders using PowerShell in a variety of ways. We looked at these forwarders from all angles.

The “windows dns conditional forwarder” is a feature that allows users to manage their standard and DNS Conditional Forwarders with PowerShell.

Related Tags

  • export dns conditional forwarders
  • how to configure conditional forwarding in dns 2019
  • dns conditional forwarder domain trust
  • powershell list conditional forwarders
  • powershell remove conditional forwarder

Table of Content