22 January,2021 by Jack Vamvas
Question: I need to configure some applications to use some Domain Controllers . To establish the address - I need to list the Domain Controllers within the Active Directory Forest. Is there a method in Powershell to create a list of Domain Controllers ?
Answer: Powershell has a flexible group of Powershell cmdlets to get information about the Active Directory . Combining Get-ADForest and Get-ADDomainController will create a recordset
Here is a sample code snippet :
(Get-ADForest).Domains | % { Get-ADDomainController -Discover -DomainName $_ } | % { Get-ADDomainController -server $_.Name -filter * } | Select Name, Domain, Forest, IPv4Address, Site | ft
Read more on Powershell and Active Directory
How to find Active Directory users with Get-ADUser search filter
How to get the Active Directory groups membership for user with Powershell
How to Export Active Directory Group Members with Powershell Get-ADGroupMember
SQL Server – Powershell Active Directory search
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |