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
Make sure you have "RSAT" installed on you laptop.
Now Import the Active Directory module.
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