Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Mass Create Mailboxes for Existing Users

Management With PowerShell

How to Mass Create Mailboxes for Existing Users

by  markdmac  Posted    (Edited  )
markdmac's Managing Exchange 2007 With PowerShell Scripts

By Mark D. MacLachlan, The Spiders Parlor
http://www.thespidersparlor.com


The following PowerShell script will query AD for users and create mailboxes for them in Exchange 2007. Just replace the servername portion in [red]red[/red] with your Exchange server's name. If you changed the store name from the default, edit the part in [blue]blue[/blue] too.

Code:
get-user | where-object{$_.RecipientType ûeq "User"} | Enable-Mailbox ûDatabase "[red]servername[/red]\[blue]Mailbox Database[/blue]" | get-mailbox | select name,windowsemailaddress,database

If you would like to target a specific OU instead of traversing the entire AD tree, you can do so by specifying the OU name. Note the OU name is in [green]green[/green] below.

Code:
get-user ûorganizationalUnit [green]Accounting[/green] | where-object{$_.RecipientType ûeq "User"} | Enable-Mailbox ûDatabase "[red]servername[/red]\[blue]Mailbox Database[/blue]" | get-mailbox | select name,windowsemailaddress,database
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top