Adding mailboxes in Powershell in nested OU
Hello All, I'm working on setting up Exchange 2010 in my domain and I'm currently at the add user mailbox stage. That being said I am wondering if it is possible to add user mailboxes via Powershell which are in nested OUs (sub OUs)? Basically in our domain environment there are several schools and each school requires it's own OU with a sub OU for Staff and another sub OU for Students. This is required in order to set up our group policies the way they need to be in order to make my life a whole lot easier. In our Exchange environment we are only interested in having mailboxes for the Staff so we will not need or want any mailboxes created for the students. How can I add user mailboxes through Powershell using active directory and only target specific sub OUs (Staff) to avoid creating accounts for Students? Currently the only Powershell command I know of to add user mailboxes is: get-user -OrganizationalUnit "Name of OU" | Where-Object{$_.RecipientType -eq "User"} | Enable-Mailbox -Database "Database Name" This only seems to work for Parent OUs so how can I modify it for sub OUs as well?
January 18th, 2011 6:08pm

ok yaa. you would need to specify each OUs in different command with complete organizational unit. iguess it has to be the DN of the OU i would do like get-user -organizationalUnit "DN of ou" |enable-malbox -database and run this command for each OU that you want to have mialbox enabled users in Dhruv
Free Windows Admin Tool Kit Click here and download it now
January 19th, 2011 7:28am

Not sure if you understand my post.. I had that same command line in the post basically and I'm saying it doesn't work for nested (sub) OUs and that's my issue. I've also tried calling up the parent OU before attempting to call the nested OU within it and that doesn't work either.
January 19th, 2011 11:09am

A command for adding groups would work for me as well but I would kind of prefer knowing how to do both if it's even possible.
Free Windows Admin Tool Kit Click here and download it now
January 19th, 2011 11:14am

Hi tbradley, In my opinion, Dhruv mean the distinguished name of the OU. I also have made a test like yours with exchange 2010 sp1 ru1, everything work well. I would suggest that you could update your exchange for the latest version, and make a test. Regards! Gavin Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
January 21st, 2011 5:52am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics