enable mailbox for all users on specifica OU


i need a command to give mailbox for all existing AD account on specifica OU.

the OU have sub OU and i need mailbox for all OU and sub OU.

ad 2008 r2 and exchange 2013.

thanks for help
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Simon Butler (Sembee)ConsultantCommented:
Get-User -OrganizationalUnit "OU Name" | Enable-Mailbox

You will need to do the sub OU separately.

cawasakiAuthor Commented:

Ok i test, ou name must bee in what form?
Simon Butler (Sembee)ConsultantCommented:
It should just be name\name\name etc
Nothing special.

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

cawasakiAuthor Commented:

i have this error for all user:

This task does not support recipients of this type. The specified recipient domain/Users/User Name is of type UserMailbox. Please make sure that this recipient matches the required recipient type for this task.
Simon Butler (Sembee)ConsultantCommented:
That would suggest that the user accounts are already mail enabled.
Will SzymkowskiSenior Solution ArchitectCommented:
Use the following command to accomplish this using powershell.

import-module activedirectory
$OUSearch = Get-ADUser -Filter * -SearchBase "OU=Sublevel, OU=toplevel,DC=domain,DC=com"
Foreach ($User in $OUSearch) {

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.