• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1385
  • Last Modified:

Create Exchange 2010 Mailbox from Import file CSV

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?
0
gregurl
Asked:
gregurl
3 Solutions
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
how to setup bulk email accounts for users using powershell

http://www.myexchangeworld.com/2010/02/powershell-provisioning-users/
0
 
ActiveDirectorymanCommented:

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.
http://www.myexchangeworld.com/2010/02/powershell-provisioning-users/
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
@ActiveDirectoryMan you posted an identical link!
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
gregurlAuthor Commented:
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
0
 
suriyaehnopCommented:
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"
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
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"
0
 
gregurlAuthor Commented:
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.
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
Glad your accounts are enabled.
0
 
gregurlAuthor Commented:
The exact  syntax in the solution fix my exact problem. The other comments did assist in the solution.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

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