Import Bulk Mail Messages with Exchange 2010

2017-12-07T12:10:45+00:00 January 15th, 2010|Exchange|

You may come across an issue where you need to import multiples PST’s into users mailboxes but you don’t want to do it manually, if that the case you’ve came to the right place 🙂

First thing to do is  install outlook 2010 on your exchange server.

Once this is done you can use Rob’s (http://risualblogs.com/blog/author/robb/) Powershell command to automate this.

Follow the below instructions to help you achieve the bulk PST imports you need.

Instructions

Before we run this powershell script we will first need to place all the PST’s locally on the server we are doing the imports on (Mailbox Server) which is simple enough.

And finally before running this script we need to create a csv file, to do this see below.

1, open notepad.exe

2, now write the following text on your first line in notepad “mailbox,pst” (without quotation marks)

3, Go to the next line and then type a users mailbox  first and then add a comma and finally type the name of the users pst.

4, You should end up with a list like below with all the users you want to import

mailbox,pst
Daniel1,Daniel1.pst
Dan,Dan.pst
Daniel,daniel.pst

5, Finally save the file as a csv file and name it “pstlocations.csv”

6, Now open notepad again and copy all the below text into it. Be sure to only change the three values I’ve made bold and you can change the directory they are pointing to, to suit your environment and also you can change what you want to import into the mailbox by altering the IncludeFolders switch (currently only importing Contacts and Calendar items). Finally save this as a PS1 file and run this via the Exchange management Shell.
_________________________________________________________________________

###Script to import calendar and contact items from pst’s to mailboxes

#set this to the path containing the pst files

$pstfolderpath = “c:psts”

$users = import-csv ‘C:pstlocations.csv’

#dont change below this line

foreach ($record in $users)

{

            $filelocation = $pstfolderpath + $record.pst

            $mailbox = $record.mailbox

            Write-Host -foregroundcolor “green” “Importing” $filelocation” to mailbox” $record.mailbox

            $command = “import-mailbox -Identity $mailbox -PSTFolderPath $filelocation –IncludeFolders ‘Contacts’, ‘Calendar’

            invoke-expression $command

}

____________________________________________________________________________                                                                                             

Hope this Helps 🙂

Daniel Davies