The first point when creating a new mailbox in Exchange 2010 is does the User Object already exist in Active Directory? In which case you just need to Mail-Enable that user.
Alternatively, do you need an example of how to create a brand new user complete with Exchange 2010 mailbox? In which case read on, I will explain all the steps necessary to succeed.
- PowerShell New-Mailbox Example
- Additional Parameters for New-Mailbox
- Where Next With Creating Exchange Mailboxes?
Note that this PowerShell cmdlet uses the verb ‘New’ and these are the minimal parameters we need to supply with values in script:
You almost always also need these parameters:
Alias, Database, Firstname, and LastName.
# Create a Mailbox with PowerShell
New-Mailbox -UserPrincipalName email@example.com `
-Database "Mailbox Db01"`
-DisplayName "Guy Thomas"`
Note 1: Because I wanted to highlight the Parameters with their values I used the backtick (`) to tell PowerShell the command continues on the next line.
Here is a production version with no backticks
# Create a Mailbox with PowerShell
New-Mailbox -UserPrincipalName Guido@contoso.com -Alias Guido -Name GuidoThomas -OrganizationalUnit Users -Password Chang5Me -Firstname Guido -LastName Thomas -DisplayName "Guido Thomas"
Note 2: Once you create a mailbox enabled user you may like to check the result with the sister PowerShell cmdlet: Get-Mailbox.
Get-Mailbox -Identity "Guido Thomas"
Import users from a spreadsheet, complete with their mailbox. Just provide a list of the users with the fields in the top row, and save as .csv file. Then launch this FREE utility, match your Exchange fields with AD’s attributes, click and import the users. Optionally, you can provide the name of the OU where the new mailboxes will be born.
- Bulk-import new users and mailboxes into Active Directory.
- Seek and zap unwanted user accounts.
- Find inactive computers.
Before I create a user and their mailbox with PowerShell I like to have a manual walk-through. For instance, EMC, New Mailbox reminds me that Alias cannot have spaces.
- Launch the EMC, navigate to the Recipient Configuration
- Right-click: New Mailbox. See screenshot right
Another benefit of creating a test user manually is that it spurs me to research more parameters or user properties with PowerShell’s own Get-Help
Note 3: Rarely have I seen a PowerShell cmdlet with so many parameters, for example, Office, Phone and Department, to name but three.
Note 4: Even though I have used this technique many times:
Get-Help Verb-PowerShellNoun, the results never cease to surprise me for example, you could create a ‘Room’ or ‘Building’ type of Exchange 2010 mailbox.
One of the reasons for scripting is to tackle repetitive tasks such as bulk import of users. My approach is to break the task down in to steps. Get each component working then bolt it all together.
- In this instance I would learn how to create one user with their mailbox (see above).
- Next I would master PowerShell’s looping techniques.
- Then I would investigate the best method of reading the list of users and their properties, Import-CSV or possibly Get-Content.
- Naturally, a key element is using PowerShell’s $Variables to build the properties of each user.
Other Members of the Mailbox Family of Cmdlets
As I have already mentioned I would start with Get-Mailbox, but there are other similar PowerShell cmdlets, research thus:
Get-Command -noun Mailbox
More Examples of Mailbox Cmdlets
Here is a free tool to monitor your Exchange Server. Download and install the utility, then inspect your mail queues, monitor the Exchange server’s memory, confirm there is enough disk space, and check the CPU utilization.
This is the real deal – there is no catch. SolarWinds provides this fully-functioning freebie, as part of their commitment to supporting the network management community.
Summary of Create Exchange Mailbox with PowerShell
It’s not that easy to create mail-enabled objects in PowerShell. It takes time to master all the New-Mailbox parameters; in particular to identify all the required properties for the user.
If you like this page then please share it with your friends