Uncategorized · February 1, 2021 0

Display all domains or Globalcatalogs within a forest

You might been in a situation where you find yourself troubleshooting issues in a largescale forest and want to keep an eye on the Domains and for that I am here to share with you something I use

basically PS enables you to use the command GETADForest ; it will show all the essential information your forest contain including an array of the Domains (for better viewing zoom your browser)

this means, if you are basically interested in listing the domain names in your forest, your can simply execute this PS as you seen below

similarly, if you are interested in listing the GloablCatalogs in your forest you can write something like


well, I am here to show you more than listing your domains ; ) as you might need to get some nice table showing you the Domain names and the PDC names along with IP address and sites. For that you need to combine the previous code with Get-ADDomainController as seen below

$domains = (Get-ADForest).domains
Foreach ($domain in $domains)
Get-ADDomainController -DomainName $domain -Discover -Service PrimaryDC | Format-Table

the result would look like below (for better viewing zoom your browser)

now you know where to start looking in your forest. You might noticed that I used -Discover in combination with -Service PrimaryDC and that is something you can to change if you want to discover other services! for example you can use -Discover -Service “GlobalCatalog” to list the Global catalogs in your forest.

here you may read more about Get-ADDomainController

Happy Power shelling


Close Bitnami banner