Keeping track of all Domain Controllers (DCs) within a domain is important when managing an Active Directory (AD) environment. It provides essential information for various tasks, including effectively managing, maintaining, securing, and troubleshooting your Active Directory environment.
How to Use PowerShell for Listing Domain Controllers
The Get-ADDomainController PowerShell cmdlet is used to list all domain controllers. This cmdlet can show all domain controllers or list specific ones with the various search parameters.
List all domain controllers in the domain
This command will list the name of each domain controller with no additional information:
Get-ADDomainController -filter * | Select-Object name
List all domain controllers (with full details)
To see more details about the DC, for example, the domain name, forest, IP address, etc use this command:
Get-ADDomainController -filter *
Export list of Domain Controllers to csv
To export any of these commands, add export-csv -path to the end of the statement:
Get-ADDomainController -filter * | Select-Object name | export-csv -path c:\Docs\domain_controllers_list.csv
How Lepide Helps
Lepide Auditor for Active Directory includes many pre-defined reports which make it a straightforward process to list domain controller information with no knowledge of PowerShell scripting required. The following example is the Domain Controller Modifications Report:
To run this report:
- Select Lepide Auditor, Reports
- From here, expand Active Directory from the tree structure on the left hand side
- Select Domain Controller Modifications
- Specify a Date Range or leave it as the default of today
- Select Generate Report
The report can be filtered, sorted and exported to CSV and PDF formats