Is there any simple way of getting a list of all the OUs located one level under a given OU?
i.e. I have an OU called "Clients" and one level under this OU there are multiple OUs , one for each client. i.e. CAS, ADI, PMA
I would like to get a list with the description of these sub OUs. Following the previous example, the result would be: "Casio, Adidas, Puma"
I tried Get-ADOrganizationalUnit but I couldn't figure out a way of doing this.
Thanks
Would this help you out:
$OU = 'OU=Europe,OU=World,DC=domain,DC=net'
Get-ADOrganizationalUnit -SearchBase $OU -SearchScope Subtree -Filter * |
Select-Object DistinguishedName, Name
You can find information on how to use the CmdLet Get-ADOrganizationalUnit
by typing:
help Get-ADOrganizationalUnit -Example