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 “pnlab.com/pnlab/users/needmailenabled” | Enable-Mailbox -Database “PNLAB storage group\mailbox database”

Explaination:
Get-User -OrganizationalUnit “pnlab.com/pnlab/users/needmailenabled” | lists all users in the pnlab.com 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.

2 comments

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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.