Posts RSS Comments RSS 253 Posts and 411 Comments till now

List of All Domain Controllers in Your Domain

The Scripting guys have a post over here: Hey, Scripting Guy! Can I Obtain a List of All Domain Controllers in My Domain?

That is one way but IMO this is easier and more DC specific data

[DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers

On a side note: The AD Replication Module will have a cmdlet so you will be able to just do this:

Get-ADRDomainController -domain MyDomain

One Response to “List of All Domain Controllers in Your Domain”

  1. on 31 Dec 2009 at 1:50 pmCameron Ove

    Hi Brandon,
    FYI…(you probably already know this but anyway …)

    The new ActiveDirectory module shipped with RSAT has a cmdlet Get-ADDomainController

    Running it without any parameters gave me the PDC emulator of my default domain context.

    Get-ADDomainController -Filter * gave me details on all of the DCs in my domain.

    Get-ADDomainController -Filter * -server sister.domain.com gave me details on all the DCs in the sibling domain to mine in my forest.

    Get-ADDomainController -Filter * -server trusted.domain.com gave me details on all the DCs in a trusted domain in another forest.

    The command allows you to use -Credential parameter so you can connect to an untrusted domain with the proper credentials.

    Gotta be running Win7 or Win2008 R2 to use the new module.

Trackback this post | Feed on Comments to this post

Leave a Reply

You must be logged in to post a comment.