Solved

How do you create mailboxes for an existing users in Exchange 2013?

Posted on 2015-01-12
7
5,177 Views
Last Modified: 2015-01-28
How do you create mailboxes for an existing users in Exchange 2013? From what I can see, with exchange admin center (EAC) you can’t select more than one existing user in Active Directory. Well, I don't really want to do it one by one for the 130 users. In Exchange 2007 it was very easy task to do inside the exchange management console.
I need a bit of help with the Exchange 2013 PowerShell command to create (enable) mailboxes for the existing users in OU. Keep in mind that some users in OU already have mailboxes enabled and some don’t. Mailboxes for all users in OU will be created on the same Exchange database.
Thanks in advance
0
Comment
Question by:Olevo
7 Comments
 
LVL 17

Expert Comment

by:Emmanuel Adebayo
ID: 40544082
Hi,

You can use the Enable-Mailbox See the usage below

Enable-Mailbox -Identity Domain\username -Database <Exchange>

This will create a mailbox for the existing username. The mailbox is created in Exchange.
Regards
0
 
LVL 63

Accepted Solution

by:
Simon Butler (Sembee) earned 500 total points
ID: 40544087
This should work for you:
get-user -OrganizationalUnit "Staff OU" | enable-mailbox -database "Mailbox Database 4"  

Change the OU to match the name of the OU you want to enable, and the database to match the database you want to use.

It only works for OUs, so "Users" which is built in to ADUC doesn't work. If the OU is nested then you will probably have to do the complete path.

Users in the OU who are already mailbox enabled will throw an error.

Simon.
0
 
LVL 9

Expert Comment

by:schmiegu
ID: 40544319
Try this:
Get-ADUser -Searchbase 'OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM' -Filter "*" -Properties * | Where {!($_.HomeMDB)} | Enable-Mailbox -Database "ABC"

I search an OU (and Sub-OUs) for all users, then apply a filter to the users, that don't have a mailbox database and then I enable the mailbox. Instead of enabling the mailbox you may want to display the results: Ommit the last pipe or use e.g. "ft DistinguishedName"

BTW: I don't know a cmdlet "Get-User"
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 1

Author Comment

by:Olevo
ID: 40545921
Thanks schmiegu, your solution is exactly what I want, however...
Before I'm going to enable mailboxes for the existing AD users in OU I would like to know which user doesn't have mailbox in  Exchange 2013 Server.
Running following powershell command in Exchange console:
Get-ADUser -Searchbase 'OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM' -Filter "*" -Properties * | Where {!($_.HomeMDB)}
... shows all users in OU (with and without mailbox in Exchange server) and all of them have 'HomeMDB' field empty?!  Perhaps we need to filter by different field...
0
 
LVL 9

Expert Comment

by:schmiegu
ID: 40546028
This command shows only the users, that don't have a mailbox. They don't even have the property HomeMDB - they get this (and a lot of others) with enable-mailbox. To see the users with mailboxes, the where clause would read: Where {$_.homeMDB}.
To see the different properties you can use:
Get-ADUser MailEnabledUser -Properties * | gm 

Open in new window

or
Get-ADUser NotMailEnabledUser -Properties * | gm

Open in new window

You can filter on any of the properties, a not mail enabled user doesn't have. HomeMDB is one of them - and I'm used to use this property for filtering.
0
 
LVL 1

Author Comment

by:Olevo
ID: 40548076
Sorry schmiegu but your proposed powershell command just don’t work for me ;-( Perhaps, something else needs to be added or removed from the command?!

Get-ADUser -SearchBase 'OU=Staff,DC=FABRIKAM,DC=COM' -Filter "*" -Properties * | where {!($_.homeMDB)} | Enable-Mailbox -Database “Staff”
~~~Error~~~
The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
    + CategoryInfo          : InvalidArgument: (CN=Kate Smith,OU...ff,DC=COM:PSObject) [Enable-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,Enable-Mailbox
    + PSComputerName        : ex2013srv.fabrikam.com
~~~

Anyway, looks like Simon Butler (Sembee) was on a right track here. Here is the PowerShell command I have used and all works fine for me.

Get-User -OrganizationalUnit "Staff" -RecipientTypeDetails User | Enable-Mailbox -Database Staff

FYI: Here is some info from :
Microsoft Exchange Server 2013 PowerShell Cookbook (Second Edition) by Jonas Andersson and Mike Pfeiffer
Chapter 3: Managing Recipients (Page 88-89)
===
The only requirement when running the Enable-Mailbox cmdlet is that you provide the identity of the Active Directory user that should be mailbox-enabled. In the previous example, we've specified the database in which the mailbox should be created, but this is optional. The Enable-Mailbox cmdlet supports a number of other parameters that you can use to control the initial settings for the mailbox.

You can use a simple one-liner to create mailboxes in bulk for existing Active Directory users:

Get-User -RecipientTypeDetails User |Enable-Mailbox -Database DAGDB1

Notice that we've run the Get-User cmdlet specifying User as the value for the -RecipientTypeDetails parameter. This will retrieve only the accounts in Active Directory that have not been mailbox-enabled. We then pipe those objects down to the Enable-Mailbox cmdlet and mailboxes are created for each of those users in one simple operation.
===
0
 
LVL 9

Expert Comment

by:schmiegu
ID: 40548462
Now I've found the get-user cmdlet (the exchange management snap-in is needed, which I have not installed on my workstation).
It seems, the -Identity param of enable mailbox doesn't accept distinguished names, so maybe an additional pipe (| select  UserPrincipalName) would solve the problem (according to the enable-mailbox help examples Identity shoul accept UPNs and Domain\user).

But Get-User is the way to go.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question