PowerShell to List Domain Controllers in Active Directory

List All Domain Controllers using Lepide Auditor
x
Table of contents

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 in the domain

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 *
List all domain controllers

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:

Domain Controller 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

List All Domain Controllers using Lepide Auditor

x
Event Viewer is not powerful enough for tracking AD changes.

The Lepide Change Reporter for AD is a free tool that will help you Track all AD changes.

  • Detailed audit report for all AD changes/events, including logon/logoff behavior.
  • Who, what, when, and where questions answered.
Download free tool