Domain controllers and Global catalogs in the current site

This little script kills two birds with one stone. Which is great unless you happen to be a little bird.

We can use this to discover the domain controllers, and which of them are global catalogs, in the current site

$site = [System.DirectoryServices.ActiveDirectory.ActiveDirectorySite]::GetComputerSite()            
$site.Servers | select Name, Domain, @{Label="GC";Expression={$_.IsGlobalCatalog()}}

Use the ActiveDirectorySite class’ GetComputerSite method. Pipe the collection of servers and select the name and domain. The IsGlobalCatalog() method on the domain controller object is used to determine if it is a global catalog

This entry was posted in PowerShell and Active Directory. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s