header image

Finding Global Catalog servers in the forest

Posted by: | March 18, 2012 | No Comment |

Global catalogs are domain controllers that also hold a subset of information on all objects in the forest. They are a required infrastructure component for Universal Groups and Exchange among other things.

Get-ADForest |             
select -ExpandProperty GlobalCatalogs |            
$for = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()            
$for.FindAllGlobalCatalogs() |             
select Name, IPAddress |             

Only two options for discovering them. The Microsoft cmdlets provide a Get-ADForest that returns an object representing the forest – it includes a collection of global catalog names

The Script uses System.DirectoryServices.ActiveDirectory.Forest and the GetCurrentForest() method to discover the forest object and the collection of global catalogs.

There doesn’t seem to be an easy way to do the job through the provider or the Quest cmdlets

under: PowerShell and Active Directory