Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7311
  • Last Modified:

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

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
Olevo
Asked:
Olevo
1 Solution
 
Emmanuel AdebayoCommented:
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
 
Simon Butler (Sembee)ConsultantCommented:
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
 
schmieguCommented:
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
Lessons on Wi-Fi & Recommendations on KRACK

Simplicity and security can be a difficult  balance for any business to tackle. Join us on December 6th for a look at your company's biggest security gap. We will also address the most recent attack, "KRACK" and provide recommendations on how to secure your Wi-Fi network today!

 
OlevoAuthor Commented:
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
 
schmieguCommented:
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
 
OlevoAuthor Commented:
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
 
schmieguCommented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now