How to Import Users via CSV in Exchange 2010

Create an csv file with the necessary information across the top row of the file as such:


The top row is going to coordinate with the S_.value that you are going to use in the following Exchange Shell command:

Import-CSV “C:\Mailboxes.csv” | foreach {new-mailbox –Name $ –Alias $_.alias –UserPrincipalName $_.userprincipalname –Database $_.Database –OrganizationalUnit $_.organizationalunit –password (ConvertTo-SecureString $_.password –AsPlainText –force)}


And you should see the mailbox’s created below:


That’s it.  You can see how the values map with their respective column names.  You can add as many users as you want, and change it so they go to different database’s.

You can even create an automated job to export from your production servers, and them import them to your DEV Exchange Servers for testing. 

This entry was posted in exchange 2007, Exchange 2010 and tagged , , . Bookmark the permalink.

8 Responses to How to Import Users via CSV in Exchange 2010

  1. Lenny says:

    Curious if you could add the archive database is this as well ? Also is the pw option the admins pw or does that force the reset of the users pw ?

    • ponzekap2 says:


      Yes, you can add any values of creating the users into the spreadsheet. And the PW that we set creates the users password, but you can add options to force them to reset it after their initial log in.

  2. Lenny says:

    Is this to create a new user in AD and create a mailbox as well ? If I had an AD user and just wanted to create a mailbox I would use the enable PS command correct ?

  3. Lenny says:

    This is my script but I keep getting

    Import-CSV “c:\test.csv” | foreach {enable-mailbox –Identity $_.Identity –DisplayName $_.Displayname -Alias $_.Alias
    –Database $_.Database -Archive $_.Archive -Archivedatabase $_.ArchiveDatabase}

    Parameter set cannot be resolved using the specified named parameters.
    + CategoryInfo : InvalidArgument: (:) [Enable-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Enable-Mailbox

    My CSV File

    Test Test4,ttest4,ttest4@,DB1,$true,Archive Database
    Test Test5,ttest5,ttest5@,DB1,$true,Archive Database
    Test Test6,ttest6,ttest6@,DB1,$true,Archive Database
    Test Test7,ttest7,ttest7@,DB1,$true,Archive Database

  4. Lenny says:

    Got it.

    Import-CSV “c:\test.csv” | foreach {enable-mailbox –Identity $_.Identity –DisplayName $_.Displayname -PrimarySmtpAddress $_.SMTP –Database $_.Database | Enable-Mailbox –Archive -ArchiveDatabase “Archive Database” | Set-Mailbox -EmailAddressPolicyEnabled:$true}

    CSV File:

    Test Test4,Test Test4,ttest4@domainname,DB1
    Test Test5,Test Test5,ttest5@domainname,DB1
    Test Test6,Test Test6,ttest6@domainname,DB1
    Test Test7,Test Test7,ttest7@domainname,DB1

  5. an nguyen says:

    can you show me all parameters of this command?
    such as:
    do they exist in import-csv?

  6. Neilus says:

    Import-CSV “user.csv” | ForEach-Object { New-Mailbox -Name $_.”dname” -FirstName $_.”fname” -LastName $_.”lname” -UserPrincipalName $_.”aname”+@Domain.local -SamAccountName $_.”aname” -Alias $_.”alias” -Password (ConvertTo-SecureString $_.password -AsPlainText -Force) -ResetPasswordOnNextLogon $false -OrganizationalUnit “Domain.local/OU/Users” -Database “Mailbox Database” -RetentionPolicy “Default Archive and Retention Policy” -ActiveSyncMailboxPolicy “Default”|Set-User -Department $_.”department” -Title $_.”title” -Company $_.”company”}



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s