Identifying all Forests on the Network

Hi,

Is there a way to return all the forests on your network? I need to be able get the collection of forests and then then get all domains on each forest for some automation that I am trying to write.

Appreciate the assistance.

Cheers!

Parents
No Data
Reply
  • PS C:\Windows> ([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() ).GetAllTrustRelationships()

    PS C:\Windows> ([System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()).GetAllTrustRelationships()

Children
No Data