TestimoX

API Reference

Command

Get-ADXOrganizationalUnit

Namespace ADPlayground.PowerShell
Outputs
ADPlayground.DirectoryObjectSnapshot ADPlayground.DirectoryOrganizationalUnitListItem

Retrieves Active Directory organizational units in list mode or a single organizational unit by identity.

Examples

Authored help example

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 Identity

Parameters

Identity string requiredposition: 0pipeline: falsealiases: DistinguishedName, DN, Name, OU
Gets or sets organizational unit identity (DN, ou, or name) for single-object mode.
AllMatches SwitchParameter optionalposition: namedpipeline: false
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[] optionalposition: namedpipeline: falsealiases: DomainName
Gets or sets domain DNS names. In list mode defaults to current domain.
IncludeTrustedDomains SwitchParameter optionalposition: namedpipeline: false
Includes trusted domains when using forest-based scopes.
Property string[] optionalposition: namedpipeline: false
Gets or sets optional additional LDAP attributes to return.
Scope DirectoryScenarioScope optionalposition: namedpipeline: falsevalues: 4
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 + MaxResults

Parameters

Domain string[] optionalposition: 0pipeline: falsealiases: DomainName
Gets or sets domain DNS names. In list mode defaults to current domain.
IncludeTrustedDomains SwitchParameter optionalposition: namedpipeline: false
Includes trusted domains when using forest-based scopes.
MaxDepth int optionalposition: namedpipeline: false
Gets or sets optional maximum OU depth in list mode.
MaxResults int optionalposition: namedpipeline: false
Gets or sets maximum number of OUs returned per domain in list mode.
MinDepth int optionalposition: namedpipeline: false
Gets or sets optional minimum OU depth in list mode.
NameLike string optionalposition: namedpipeline: false
Gets or sets wildcard filter for OU name/canonical name/DN in list mode.
OneLevel SwitchParameter optionalposition: namedpipeline: false
Gets or sets whether list mode should return only direct child OUs.
Property string[] optionalposition: namedpipeline: false
Gets or sets optional additional LDAP attributes to return.
Scope DirectoryScenarioScope optionalposition: namedpipeline: falsevalues: 4
Default scope used when -Domain is not provided. Possible values: CurrentDomain, Forest, TrustedForests, ExplicitDomains
Possible values: CurrentDomain, Forest, TrustedForests, ExplicitDomains
SearchBase string optionalposition: namedpipeline: false
Gets or sets optional search base distinguished name for list mode.

Outputs

ADPlayground.DirectoryObjectSnapshot, ADPlayground.DirectoryOrganizationalUnitListItem