API Reference
Command
Get-ADXOrganizationalUnit
Retrieves Active Directory organizational units in list mode or a single organizational unit by identity.
Examples
Example 1: Default identity mode with a single expected match
Get-ADXOrganizationalUnit -Identity 'OU=Servers,DC=contoso,DC=com'
Example 2: Return all matches across queried domains
Get-ADXOrganizationalUnit -Identity 'OU=Servers' -Domain 'contoso.com','fabrikam.com' -AllMatches
Example 3: Return all matches across forest domains
Get-ADXOrganizationalUnit -Identity 'OU=Servers' -AllMatches
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.
Syntax
Get-ADXOrganizationalUnit -Identity <string> [-AllMatches] [-Domain <string[]>] [-IncludeTrustedDomains] [-Property <string[]>] [-Scope <CurrentDomain|Forest|TrustedForests|ExplicitDomains>] [<CommonParameters>]#Parameter set:
By IdentityParameters
- Identity string
- Gets or sets organizational unit identity (DN, ou, or name) for single-object mode.
- AllMatches SwitchParameter
- Gets or sets whether identity mode should return all matches across queried domains. By default (switch not set), identity mode expects a single match and throws on ambiguity.
- Domain string[]
- Gets or sets domain DNS names. In list mode defaults to current domain.
- IncludeTrustedDomains SwitchParameter
- Includes trusted domains when using forest-based scopes.
- Property string[]
- Gets or sets optional additional LDAP attributes to return.
- Scope DirectoryScenarioScope
- Default scope used when -Domain is not provided. Possible values: CurrentDomain, Forest, TrustedForests, ExplicitDomains
- Possible values:
CurrentDomain,Forest,TrustedForests,ExplicitDomains
Outputs
ADPlayground.DirectoryObjectSnapshot, ADPlayground.DirectoryOrganizationalUnitListItem
Get-ADXOrganizationalUnit [-Domain <string[]>] [-IncludeTrustedDomains] [-MaxDepth <int>] [-MaxResults <int>] [-MinDepth <int>] [-NameLike <string>] [-OneLevel] [-Property <string[]>] [-Scope <CurrentDomain|Forest|TrustedForests|ExplicitDomains>] [-SearchBase <string>] [<CommonParameters>]#Parameter set:
By MaxDepth + MaxResultsParameters
- Domain string[]
- Gets or sets domain DNS names. In list mode defaults to current domain.
- IncludeTrustedDomains SwitchParameter
- Includes trusted domains when using forest-based scopes.
- MaxDepth int
- Gets or sets optional maximum OU depth in list mode.
- MaxResults int
- Gets or sets maximum number of OUs returned per domain in list mode.
- MinDepth int
- Gets or sets optional minimum OU depth in list mode.
- NameLike string
- Gets or sets wildcard filter for OU name/canonical name/DN in list mode.
- OneLevel SwitchParameter
- Gets or sets whether list mode should return only direct child OUs.
- Property string[]
- Gets or sets optional additional LDAP attributes to return.
- Scope DirectoryScenarioScope
- Default scope used when -Domain is not provided. Possible values: CurrentDomain, Forest, TrustedForests, ExplicitDomains
- Possible values:
CurrentDomain,Forest,TrustedForests,ExplicitDomains - SearchBase string
- Gets or sets optional search base distinguished name for list mode.
Outputs
ADPlayground.DirectoryObjectSnapshot, ADPlayground.DirectoryOrganizationalUnitListItem