Hi,
These days i think i am only and only working with Active Directory. My Manager give me the task to show him the all Organizational Unit Container , so that we can re-arrange them and remove the OU those are not required any longer.
Seriously i don’t know any way to do this. I never heard about it and never tried it before. Why ? my manager needs it ? that the first thought came in my mind, but buddy manager is a manager ;o) , i have to do it what he said.
The again i decide lets explore some Active Directory cmdlets and see if it have something.
In first attempt i found a single cmdlet which is able to do this. That is Get-ADOrganizationalUnit
Let’s Start.
Make sure you have “RSAT“ installed on you laptop.
Now Import the Active Directory module.
Import-Module ActiveDirectory
..
ok, Module is imported,
…
First run the to view all OUs run the single cmdlet with –Filter * parameters
Get-ADOrganizationalUnit –Filter *
It is showing us the details of all OUs.
But i am still not satisfy with the result. let it filter more ,,
Get-ADOrganizationalUnit –Filter * | Select Name
I tried to select Name but the output is not so good. Because we can see Name but for example in below screenshot i have multiple OU container named as Users
ok…still not happy.
let run another command
Get-ADOrganizationalUnit –Filter * –properties * | Select CanonicalName
This command will show is a full path of our OUs.
All Done 🙂
My Target of the day i achieved. Now can do facebook ;o) ;o)
Thanks for reading
Thanks!
Aman Dhally


Thanks, been looking every where for how to export to CanonicaName!!! I owe you one 🙂
You are Welcome ANDY 🙂
why not use:
Get-ADOrganizationalUnit -Filter * -properties * | Select DistinguishedName
I think a DN is more useful than the canonical name.
Hi Harold,
Nice idea.
I think, there is always more then one way to accomplish the same thing. 🙂
Regards
Aman Dhally
hi!
how can I find EMPTY OUs in AD?
hi
good jobs how I can create many OUs in AD and after this create many or one group for each ou from list liste file content the name of OUs and content the name list of group
Thanks