Create Exchange 2010 Mailbox from Import file CSV

Posted on 2011-04-23
Medium Priority
Last Modified: 2012-05-11
I currently have users with an Active Directory account but no email account.

I would like to use the Exchange command to import a text filefile that would create the email accounts  based on the information in the text file.

The text file would contain the AD username (samaccount), the email address, option for not having email address update on email policy, and the database I will store the user's email account,

What is the command to create the accounts in Exchange?
Question by:gregurl
LVL 125

Assisted Solution

by:Andrew Hancock (VMware vExpert / EE MVE^2)
Andrew Hancock (VMware vExpert / EE MVE^2) earned 500 total points
ID: 35453916
how to setup bulk email accounts for users using powershell


Expert Comment

ID: 35454823

I concurr with hancocka but you don't have to reinvent the wheel.  There are tons of powershell scripts for exchange and AD.

I would highly suggest to look at don jones page.  don jones is known as the "Powershell" Guru. he has written a script for what you want to do using CSV files.

create bulk mailbox users.
LVL 125
ID: 35454833
@ActiveDirectoryMan you posted an identical link!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 35457843
I was working on the command to create mailbox for users that already exist in the system. The only part I have not figure out is that I want to set the primarysmtpaddress to firstname.lastname@mydomain.com instead of using the email policy. How do I set the parameters after primarysmtpaddress to use the firstname and last name in the email address?

get-user –organizationalUnit OUNewUsers| where-object {$_.RecipientType –eq “User”} | Enable-Mailbox –Database “DB1” -primarysmtpaddress | get-mailbox | select name,windowsemailaddress,database
LVL 19

Assisted Solution

suriyaehnop earned 500 total points
ID: 35458779
get-user –organizationalUnit OUNewUsers| where-object {$_.RecipientType –eq “User”} | Enable-Mailbox –Database “DB1” -primarysmtpaddress ($_.SamAccountName + '@contoso.com') -EmailAddressPolicyEnabled:$false | get-mailbox | select name,windowsemailaddress,database

If your email address policy based on "ALIAS"
LVL 125
ID: 35459030
You need to read the entire article

"the script creates a whole new user, in this scenario, you can change the script to ur need by changing the cmdlet new-mailbox to enable-mailbox"

Accepted Solution

gregurl earned 0 total points
ID: 35460818
I put the code in a text file and renamed the script to newaccount.ps1. I ran the script from the powershell. I put all the users I wanted to enable the mailbox in a OU.

$mb=get-user -organizationalUnit myOUname | where-object{$_.RecipientType -eq "User"}

$mb | foreach {$email = $_.FirstName +"."+ $_.LastName +"@mydomain";Enable-Mailbox -identity $_.SamAccountName –Database "DB1" -Alias $_.SamAccountName -primarysmtpaddress $email}

$mb | Get-Mailbox | select name,windowsemailaddress,database

The item that took a while to figure out is the syntax to know the firstname was based off of $_.firstname and last name from $_.lastname and to use variables in the script.

Thanks for all who assisted.
LVL 125
ID: 35460836
Glad your accounts are enabled.

Author Closing Comment

ID: 35496478
The exact  syntax in the solution fix my exact problem. The other comments did assist in the solution.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You finally migrated Public Folders to Office 365, decommissioned the Public Folder mailbox database and since then, when you send an email from on-premise to mail-enabled Public Folders, you get the following error: "Misconfigured public folder mai…
In this post, we will learn to set up the Group Naming policy and will see how it is going to impact the Display Name and the Email addresses of the Group.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Suggested Courses

569 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