Avatar of Albert Widjaja
Albert WidjajaFlag for Australia

asked on 

Powershell or methods to determine the number of AD forest & Domain ?

Hi All,

I'm currently performing audit from one company to another and I'd like to know if there is any way to show how many AD forest and domains in the company ?

It can be a PowerShell script or GUI console step-by-steps.

Thanks in advance.
PowershellMicrosoft 365 EnterpriseMicrosoft Server OSWindows Server 2012Active Directory

Avatar of undefined
Last Comment
Albert Widjaja
Avatar of Ogandos
Ogandos
Flag of Canada image

It will be difficult to get the list of 'forests' because there is not one specific and reliable point of reference to get that information from. Many options could arise that can let you know about the existence of other forests but they will not mean that all of them are going to be necessary listed. It will be too crazy (Network traffic, review trust relationships from the domain, etc... and anyway that will not include all the information).

One very simple way to get the amount of domains within a single forest is using the command:

(Get-ADForest).Domains
This command will give you the list of domains

And with a slight change you can get the amount in numbers
((Get-ADForest).Domains).Count

These commands are assuming that you are using PowerShell with the active directory module installed. i.e. From a DC or a domain member computer with the consoles installed.
Avatar of Albert Widjaja

ASKER

Hi Schnell,

When I viewed the AD user and console, in the Find dialog, I can see there are three domains in the drop down under the All Directories ?

but the AD Powershell above only returns just one.
Avatar of Ogandos
Ogandos
Flag of Canada image

Can you confirm if these domains belong to the same forest? I wonder if they are domains that belong to a different forest and they are listed there as part of a domain trust.
SOLUTION
Avatar of Ogandos
Ogandos
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Albert Widjaja

ASKER

Hi Schnell.

Can you confirm if these domains belong to the same forest? I wonder if they are domains that belong to a different forest and they are listed there as part of a domain trust.

Not sure with that since I'm in a new company here.

how to look into that ?
SOLUTION
Avatar of Ogandos
Ogandos
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Albert Widjaja

ASKER

Ok, so here's the result:

Trust topology information obtained from the computer AdminLaptop007 in the domain MyDomain.com on 04/19/2017 12:09:26. 
This text file contains information on all trusts: Forest, External, Shortcut and ParentChild.
There are 2 forest trusts.
There are 0 internal (intra forest) trusts.
There are 0 external trusts.
**********************************************************************************************
Active Directory Trusts for Trusts of Type internal
*********************************
Active Directory Trusts for Trusts of Type forest
*********************************


Trust Name                                        : Trust Details for MyDomain.com|UnityNetwork.int
Local Domain (Source)                             : MyDomain.com
Trusted Domain (Target)                           : UnityNetwork.int
Trust Direction                                   : Bidirectional
Trust Type                                        : Forest
Trusted Domain Info: UnityNetwork                 : DNSName UnityNetwork.int | Domain SID: S-1-5-21-1907921415-2437651183-2526027976
Trust TopLevelNames (Name Suffix Routing)         : {UnityNetwork.int}
Trust Excluded TopLevelNames(Name Suffix Routing) : None Defined
Quarantine (SIDFiltering)                         : True
Selective Authentication                          : False





Trust Name                                        : Trust Details for MyDomain.com|MyPaymentSolution.com
Local Domain (Source)                             : MyDomain.com
Trusted Domain (Target)                           : MyPaymentSolution.com
Trust Direction                                   : Bidirectional
Trust Type                                        : Forest
Trusted Domain Info: MyPaymentSolution            : DNSName MyPaymentSolution.com | Domain SID: S-1-5-21-2000478354-1060284298-839522115
Trust TopLevelNames (Name Suffix Routing)         : {MyPaymentSolution.com}
Trust Excluded TopLevelNames(Name Suffix Routing) : None Defined
Quarantine (SIDFiltering)                         : True
Selective Authentication                          : False



Active Directory Trusts for Trusts of Type external
*********************************

Open in new window


Does this means there are three AD domains under single AD forest:

MyPaymentSolution.com <----Bi directional trust---->MyDomain.com<----Bi directional trust---->UnityNetwork.int
ASKER CERTIFIED SOLUTION
Avatar of Ogandos
Ogandos
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Albert Widjaja

ASKER

Ah I see,

Schnell, there are 3 different AD forest and each forest contains single AD domain.
the trust is Bi directional so the AD login or account in MyPaymentSolution.com  is also recognized in UnityNetwork.int AD domain ?
Avatar of Ogandos
Ogandos
Flag of Canada image

you are right !
Avatar of Albert Widjaja

ASKER

Thanks!
Active Directory
Active Directory

Active Directory (AD) is a Microsoft brand for identity-related capabilities. In the on-premises world, Windows Server AD provides a set of identity capabilities and services, and is hugely popular (88% of Fortune 1000 and 95% of enterprises use AD). This topic includes all things Active Directory including DNS, Group Policy, DFS, troubleshooting, ADFS, and all other topics under the Microsoft AD and identity umbrella.

86K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo