get-mailbox search multiple OUs

Hi I am writing a powershell script which needs to look into multiple OUs and I have this as my Get-Mailbox search but I'm unsure how to set it to look into several OUs. This is how I am writing it so far:

foreach ($mailbox in (Get-MailBox -ResultSize Unlimited  -OrganizationalUnit "domain/Students/Students-junior/test"))

Can I simply add another -OrganizationalUnit to this line so search another OU?

Any suggestions?

Greatly appreciated
Who is Participating?
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.

You could loop through the OUs just like you are looping through the mailboxes.  
Store the ou's in an array if there arent many or import them from a csv.
Something like:

foreach ($ou in $ouList)
     foreach ($mailbox in $ou)
          Get-MailBox -ResultSize Unlimited

Sorry my powershell isnt all that, still learning it too :)
Mohammed KhawajaManager - Infrastructure:  Information TechnologyCommented:
You could simply run the command get-mailbox -Resultsize unlimited and it will check for mailboxes on the domain.
Try something like the following example..

) | % {
Get-MailBox -ResultSize Unlimited  -OrganizationalUnit $_

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
Just wondering about the reason for B grade!

Please see the EE guidelines on grading..
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.