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.

Advertisements

2 comments

  1. Pete Wentzler · · Reply

    I need to mail enable the users with an external SMTP address. How can that be added?

  2. mugginsville2000@yahoo.com

    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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: