Creating Multiple Mailboxes in the Exchange Management Shell
Given the complexity of creating a new mailbox in the EMS, why would anyone want to do so? Generally, they wouldn't. But what if your Human Resources department handed you a list of 50 new employees and requested that you create new mailboxes for all of them? Doing so through the GUI interface of the EMC would not only take hours, but would also result in the increased likelihood that misspellings or mistakes might occur. That's where the power of the EMS comes into play.
By putting the list of names in a .csv file, we can quickly create multiple accounts from only two lines of code. To do so, perform the following steps:
- Create a text file called newusers.csv in a directory called (for our example) c:\scripts.
- For our example, we create several column names and populate the data. The columns we will populate are Name, Alias, UPN, First, Middle, and Last. Additional column names can be added, if desired, to populate more data in the user accounts.
- When the .csv file is complete, we are ready to begin. Each user account will be
created with a default password, with the user required to reset the password when
they first log in. From the Exchange Management Shell, type the following
command. (Type it word-for-word, do not attempt to enter the password yet.)
$Password = Read-Host "Enter Password" -AsSecureString
And press Enter. You will be presented with a prompt stating Enter Password. Type the password you want to apply to all your newly created users and press Enter. Your password will now be assigned to the variable $Password for use in our script. - Next, we run two cmdlets, piping the results of the first into the second, to create
the new mailboxes from the .csv file. The syntax will be as follows:
Import-Csv "c:\scripts\newusers.csv" | foreach { New-Mailbox -name $_.Name -alias $_.Alias -UserPrincipalName $_.UPN -FirstName $_.First -Initials $_.Middle -LastName $_.Last -Password $Password -ResetPasswordOnNextLogon:$true}
The result is the creation of the new mailboxes shown. The existence can be confirmed by viewing the mailboxes in the Exchange Management Console. (Remember to refresh the screen if you already had it open.)
Again-while this is a significant amount of work for three users, the same concept can be used to create 50 users (or 500) and can prove to be a valuable time saver.
Creating a New Mailbox in the Exchange Control Panel
Before administrators can create a new mailbox in the Exchange Control Panel, they must be granted the rights to do so using RBAC.
Once they have the appropriate permissions, creating a new mailbox in the Exchange Control Panel is so easy that it's hardly worth the time to explain it. However, because the ECP is brand new, this section runs through the process to show how quick and easy it is.
To create a new mailbox user in the Exchange Control Panel, perform the following steps:
- Log in to the OWA server with administrative credentials.
- From the OWA page, select Options.
- Select Manage Your Organization.
- Ensure My Organization is selected in the UI Scope Control, Users & Groups is selected in the Primary Navigation Panel, and Mailboxes is selected in the Secondary Navigation Panel.
- Click the New Mailboxes icon.
- On the New Mailbox page, enter the information for the new account. Those marked with asterisks (*) are required fields. An example of the New Mailbox page.
- When finished, click the Save button.
The ECP passes the information on to the CAS server, which, in turn, uses Remote PowerShell commands to perform the actual operation and create the account.
In this tutorial:
- Administering an Exchange Server
- Role Based Access Control
- Shared Versus Split Permissions Models
- Configuring Exchange Server 2010 for Split Permissions
- Administrative Tools
- Exchange Management Console
- Exchange Management Shell Command Log
- Exchange Control Panel
- Performing Common Tasks
- Creating Multiple Mailboxes in the Exchange Management Shell
- Understanding Distribution Groups
- Dynamic Distribution Groups
- Managing Distribution Groups
- Creating Mail Contacts
- Managing Disconnected Mailboxes
- Moving Mailboxes
- Recipient Configuration
- Mail Flow Settings
- Mailbox Features
- Managing Email Addresses
- Understanding Archiving
- Enabling Archiving on a Mailbox
- Using the Exchange Server 2010 Toolbox
- Public Folder Management Console
- Mail Flow Troubleshooter
- Routing Log Viewer
- Exchange Server Coexistence
- Server Administration
- Setting Limits on Databases