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

Leave a Reply