Powershell Active Directory - Limiting my get-aduser search to a specific OU [and sub OUs] Powershell Active Directory - Limiting my get-aduser search to a specific OU [and sub OUs] powershell powershell

Powershell Active Directory - Limiting my get-aduser search to a specific OU [and sub OUs]


If I understand you correctly, you need to use -SearchBase:

Get-ADUser -SearchBase "OU=Accounts,OU=RootOU,DC=ChildDomain,DC=RootDomain,DC=com" -Filter *

Note that Get-ADUser defaults to using

 -SearchScope Subtree

so you don't need to specify it. It's this that gives you all sub-OUs (and sub-sub-OUs, etc.).