How to get the details of DNS configuration on dc’s
This script will give the details of DNS server configuration on domain controller.
$dcs=Get-Content “DC.txt”
Foreach ($Computer in $dcs)
{
try {
$Networks = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE-ComputerName $Computer
-ErrorAction Stop
} catch {
“Failed to Query $Computer. Error details: $_”|Out-File dc_DNS.txt -Append
continue
}
foreach($Network in $Networks) {
$DNSServers = $Network.DNSServerSearchOrder
$NetworkName = $Network.Description
If(!$DNSServers) {
$PrimaryDNSServer = “Notset”
$SecondaryDNSServer = “Notset”
} elseif($DNSServers.count -eq 1) {
$PrimaryDNSServer = $DNSServers[0]$SecondaryDNSServer = “Notset”
} else {
$PrimaryDNSServer = $DNSServers[0]$SecondaryDNSServer = $DNSServers[1]}
$Computer + “,”+ $PrimaryDNSServer + “,” + $SecondaryDNSServer |Out-File dc_DNS.txt -append
}
If($er)
{
$Computer + “,”+ $er|Out-File dc_DNS.txt -append
}
}
Please follow below steps to execute the script.
- Get the details of domain DC’s and put it in the DC.txt
- Rename the script to DNS_details.ps1.
- Execute the script DNS_details.ps1, Output will be stored in dc_DNS.txt.
- You get the output dc_DNS.txt .
So, that’s all in this blog. I will meet you soon with some other stuff. Have a nice day !!!
Recommended content
RODC Installation Guide- Step by step guide to install read only domain controller
RODC Filtered Attribute Set
Installing and configuring a RODC in Windows Server-2012
How to find the GUID of Domain Controller
Group Policy Understanding Group Policy Preferences
Group Policy Verification Tool GPOTool Exe
Group Policy Health Check on Specific Domain Controller
What is Netlogon Folder in Active Directory
How to Create Custom Attributes in Active Directory
How Can I Check the Tombstone Lifetime of My Active Directory Forest
How to Determine a Computers AD Site From the Command Line
How to Check the Active Directory Database Integrity
How to Check the Active Directory Database Integrity
Disabling and Enabling the Outbound Replication
DFS Replication Service Stopped Replication
What is Strict Replication Consistency
The replication operation failed because of a schema mismatch between the servers involved
Troubleshooting ad replication error 8418 the replication operation failed because of a schema mismatch between the servers
How to export replication information in txt file
Repadmin Replsummary
Enabling the outbound replication
Guys please don’t forget to like and share the post. You can also share the feedback on below windows techno email id.
If you have any questions feel free to contact us on admin@windowstechno.com also follow us on facebook@windowstechno to get updates about new blog posts.