Get-ADOrganizationalUnit

Steven · 2023-04-08 19:57 · 64 views · Active Directory · old id 164


NAME
    Get-ADOrganizationalUnit
SYNOPSIS
    Gets one or more Active Directory organizational units.
    -------------------------- EXAMPLE 1 --------------------------
    C:\PS>Get-ADOrganizationalUnit -Filter Name -like "*" | FT Name, DistinguishedName -A
    Name                 DistinguishedName
    ----                 -----------------
    Domain Controllers   OU=Domain Controllers,DC=FABRIKAM,DC=COM
    UserAccounts         OU=UserAccounts,DC=FABRIKAM,DC=COM
    Sales                OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
    Marketing            OU=Marketing,OU=UserAccounts,DC=FABRIKAM,DC=COM
    Production           OU=Production,OU=UserAccounts,DC=FABRIKAM,DC=COM
    HumanResources       OU=HumanResources,OU=UserAccounts,DC=FABRIKAM,DC=COM
    NorthAmerica         OU=NorthAmerica,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
    SouthAmerica         OU=SouthAmerica,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
    Europe               OU=Europe,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
    AsiaPacific          OU=AsiaPacific,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM
    Finance              OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM
    Corporate            OU=Corporate,OU=UserAccounts,DC=FABRIKAM,DC=COM
    ApplicationServers   OU=ApplicationServers,DC=FABRIKAM,DC=COM
    Groups               OU=Groups,OU=Managed,DC=FABRIKAM,DC=COM
    PasswordPolicyGroups OU=PasswordPolicyGroups,OU=Groups,OU=Managed,DC=FABRIKAM,DC=COM
    Managed              OU=Managed,DC=FABRIKAM,DC=COM
    ServiceAccounts      OU=ServiceAccounts,OU=Managed,DC=FABRIKAM,DC=COM
    
    
    
    Description
    -----------
    
    Gets all the Organizational Units in the domain
    
    
    
    
    
    -------------------------- EXAMPLE 2 --------------------------
    C:\PS>Get-ADOrganizationalUnit -Identity OU=AsiaPacific,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM | ft 
    Name,Country,PostalCode,City,StreetAddress,State -A
    Name        Country PostalCode City     StreetAddress    State
    ----        ------- ---------- ----     -------------    -----
    AsiaPacific AU      4171       Balmoral 45 Martens Place QLD
    Description
    -----------
    Gets the Organizational Unit with DistinguishedName OU=AsiaPacific,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM.

    -------------------------- EXAMPLE 3 --------------------------
    
    C:\PS>Get-ADOrganizationalUnit -LDAPFilter (name=*) -SearchBase OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM 
    -SearchScope OneLevel | ft Name,Country,PostalCode,City,StreetAddress,State
    
    
    Name                    Country                 PostalCode             City                   StreetAddress        
      State
    ----                    -------                 ----------             ----                   -------------        
    AsiaPacific             AU                      4171                   Balmoral               45 Martens Place     
      QLD
    Europe                  UK                      NG34 0NI               QUARRINGTON            22 Station Rd
    NorthAmerica            US                      02142                  Cambridge              1634 Randolph Street 
      MA
    
    
    
    Description
    -----------
    
    Gets Organizational Units underneath the sales Organizational Unit using an LDAP filter.
    
    
    
    
    



← Back to home