Share via


Use Powershell to read Conditional Forwarders with details?

Question

Monday, April 24, 2017 5:39 PM

We are an MSP with a primary network and 100's of conditional forwarders for the customer forests we support.  I am currently doing a rolling migration of our primary site Windows 2012R2 DC's to Windows 2016 DC.

The majority of conditional forwarders were created a Active Directory integrated and are automatically published by the new Windows 2016 Domain Controllers. 

But, there were many Conditional Forwarders created on our core DC's \ DNS servers that were not AD integrated.

How can PowerShell read all DNS Conditional Forwarders with details so I can determine if they are AD integrated or manually created on that specific DNS server.  I can then used the reviewed data for creating the required conditional forwarders.

Thanks, Stu

All replies (1)

Friday, April 28, 2017 6:54 AM âś…Answered

Hi Stu,

>>How can PowerShell read all DNS Conditional Forwarders with details so I can determine if they are AD integrated or manually created on that specific DNS server.

There are two ways:

Invoke-Command -ComputerName ser1,ser2,ser3 -ScriptBlock{Get-DnsServerZone | ?{.ZoneType -eq 'Forwarder'} | fl * } -Credential $credential

Or, using WMI:

Invoke-Command -ComputerName ser1,ser2,ser3 -ScriptBlock{gwmi -Namespace root\MicrosoftDNS -Class MicrosoftDNS_Zone -Filter 'ZoneType = 4' | fl *} -credential $credential

Best regards,

Andy

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].