Making AD accounts in an OU “mail-enabled” using powershell

Exchange 2007

If you have a number of users in an OU that are not mail-enabled. You can use the following command to look for all users in a specific OU and then make them mail-enabled:

Get-User -OrganizationalUnit “” | Enable-Mailbox -Database “PNLAB storage group\mailbox database”

Get-User -OrganizationalUnit “” | lists all users in the domain, pnlab/users/needmailenabled OU and then pipe the results (line by line) into the next command

Enable-Mailbox -Database “PNLAB storage group\mailbox database” This command takes the output of the last command (Get-User) and mail-enable the AD account puting them into the “PNLAB storage group” storage group and “mailbox database” database.

The great thing about this is if there are any user(s) in that OU that are already mail-enabled, powershell will give you an error stating those users already mail-enabled and continue on to process the rest of the users.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.