Solved

Bulk Export Of Mailboxes To PST From Exchange 2010

Posted on 2013-11-18
38
1,544 Views
Last Modified: 2014-01-19
Hi All,

I have been given the task to export around 23 mailboxes from our exchange server to individual PST files.

I am wondering if there is an idiots guide/step by step guide on how to do this as I have no idea how this is done.

It needs to be done in one overnight process so creating an export on each mailbox via Exchange Management Console is not really feasible.

Any help will be appreciated.

Thanks in advance.

Joe
0
Comment
Question by:joestramandinoli
  • 20
  • 11
  • 5
  • +2
38 Comments
 
LVL 19

Expert Comment

by:bevhost
ID: 39658343
Why is EMC not feasible?
0
 
LVL 19

Expert Comment

by:bevhost
ID: 39658344
0
 

Author Comment

by:joestramandinoli
ID: 39658347
Don't you need to do it one by one in EMC?
0
 

Author Comment

by:joestramandinoli
ID: 39658351
I should also mention that the company I work for hosts exchange for multiple companies and one of the companies are leaving our hosted environment so I need to export them all to PST.
Each company is in different OU's so the company in question that is leaving our hosted services is in it's own OU.
Thanks
I need to keep all the other companies data on our exchange server and only export/remove the one company in question.
Thanks
Joe
0
 
LVL 19

Expert Comment

by:bevhost
ID: 39658524
0
 
LVL 4

Expert Comment

by:Naushad shaikh
ID: 39659231
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39659279
You can easily script this using powershell with the below command...
Before you run the script you need to construct your CSV file like the example below...

sAMAccountName     Access
jsmith                            jbryant
hsmyth                          jbryant
etc...

The sAMAccountName is the column you will use for mailboxes that you want to export. The Access column is the account that you will be using to export the mailboxes. This account requires Full Access permission on the mailbox to export the items.

Also once you create the CSV file you need to put the name of the csv file in 2 places in the script below. Replace "c:\yourCSVhere.csv" with the correct name of your csv file you create.

$Userlist = Import-Csv "c:\yourCSVhere.csv"
foreach ($Perm in $Userlist) {
$Perm.sAMAccountName
$Perm.Access
Add-MailboxPermission -Identity $Perm.sAMAccountName -User $Perm.Access -AccessRights FullAccess -InheritanceType All
}
$Userlist = Import-Csv "c:\yourCSVhere.csv"
foreach ($User in $Userlist) {
$User.sAMAccountName
Export-Mailbox -Identity $User.sAMAccountName -PSTFolderPath c:\PSTFiles -BadItemLimit 10000000
}

Open in new window


Will.
0
 

Author Comment

by:joestramandinoli
ID: 39660886
Hi Will,

Thanks for sending this through.

Can it really be that simple?

Also, does this script create different PST for each mailbox?

How do I run a script in PS?

Do I need to copy that to a text file and rename it to a bat or is it just a copy paste into Powershell?

Thanks Will

Joe
0
 
LVL 5

Expert Comment

by:nashim khan
ID: 39660905
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39661016
The pst files are individual files 1 for each mailbox. To run the script, copy the script I posted above into a text file. From there save the file extension as .ps1

Open powershell and navigate to the directory where the PS script is located. Type .\powershellname.ps1 and this will run the script.

Make sure that you update the portion of the script with the name of your own CSV name/location.

Will.
0
 

Author Comment

by:joestramandinoli
ID: 39661042
Excellent. Thanks for that Will.

Is this something that can be run on a live server? Will it have much of an impact?

Also, will the data still remain on the server in the users mailboxes after the export or does the export wipe the mailboxes?

Thanks Will.

Joe
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39661045
You can run it on the server or a workstation that has exchange tools and admin tools installed. It does put a slight tax on the server if it is run locally from the server. This is simply and export, the mailbox will still have all of the emails within it.

Will.
0
 

Author Comment

by:joestramandinoli
ID: 39661177
Thanks Will.

Appreciate your help.

Joe
0
 

Author Comment

by:joestramandinoli
ID: 39667643
Hi Will,

Is the sAMAccountName the same as the microsoft account name?

Thanks

Joe
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39667729
It is the pre-windows 2000 account name. The samaccountname is required for any account creation.

Will
0
 

Author Comment

by:joestramandinoli
ID: 39676141
Hi Will,

Sorry, just before I try it, is there a size limitation on the PST?

One of the mailboxes are 12gb and I recall that some PST files have a limit of 2Gb?

If so, how do I get around this?

Thanks

Joe
0
 
LVL 19

Expert Comment

by:bevhost
ID: 39676163
PST files have more that one format.
The older format was limited to 2GB and so was exmerge, the older export utility for Exchange 2003.  
I have several users with PST files much larger the 2GB.
I think the limit is over 20GB.
As for the new export utility, I would be very surprised if it has a 2GB limit.
Other experts may be able to confirm or deny this.
0
 
LVL 19

Expert Comment

by:bevhost
ID: 39676181
http://support.microsoft.com/kb/982577
Outlook 2003 & 2007 support 20GB,
Outlook 2010 & 2013 support 50GB.
0
 

Author Comment

by:joestramandinoli
ID: 39676267
Thanks for that information.

In case I need to kill this script (if there is too much impact on other users) is it just a matter of closing the powershell window?

Thanks

Joe
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:joestramandinoli
ID: 39676735
Hi Will/All,

I seem to be getting the following errors:

PS C:\pstfiles> .\Intech3Test.ps1
Sebastian
administrator
The term 'Add-MailboxPermission' is not recognized as the name of a cmdlet, function, script file, or operable program.
 Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\pstfiles\Intech3Test.ps1:5 char:22
+ Add-MailboxPermission <<<<  -Identity $Perm.sAMAccountName -User $Perm.Access -AccessRights FullAccess -InheritanceTy
pe All
    + CategoryInfo          : ObjectNotFound: (Add-MailboxPermission:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Sebastian
The term 'Export-Mailbox' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\pstfiles\Intech3Test.ps1:10 char:15
+ Export-Mailbox <<<<  -Identity $User.sAMAccountName -PSTFolderPath c:\PSTFiles -BadItemLimit 10000000
    + CategoryInfo          : ObjectNotFound: (Export-Mailbox:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Thanks

Joe
0
 

Author Comment

by:joestramandinoli
ID: 39691577
Does anyone have a solution for me?
0
 

Author Comment

by:joestramandinoli
ID: 39720463
Hi,

I was able to get the first part of the script to run, however, when it now gets to the export-mailbox part of the script it says that is it now a recognized cmdlet.

I have used the option to import modules into powershell, however, I am still prompted with this error message.

Can anyone help me get my exchange server to recognise export-mailbox cmdlet.

Thanks

Joe
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39720485
Export-mailbox is a exchange management snapin. You need to make sure you add the snapin to the powershell session.

Use the following command

Add-pssnapin microsoft.exchange. Management.powershell.admin

Will.
0
 

Author Comment

by:joestramandinoli
ID: 39725245
Hi Will,

I have tried that it it doesn't seem to work either.

Here is the error message:

Add-PSSnapin : The Windows PowerShell snap-in 'microsoft.exchange.management.powershell.admin' is not installed on this
 machine.

I have just checked the installation and microsoft exchange management tools are installed on this server.

Thanks

Joe
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39725309
It depends on the version of Exchange and also making sure that you have exchange management tools installed on the server or workstation you are trying to add the snapin to. For exchange 2010 instead of admin it will be e2010 and e2013 for exchange 2013. Admin is for Exchange 2007.

Will.
0
 

Author Comment

by:joestramandinoli
ID: 39725355
Thanks Will.

I am running this directly on the exchange server. It is Exchange 2010 so I am assuming I need to do e2010.

Is it recommended/supported to run this on the exchange server directly?

Thanks

Joe
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39725397
You can run this on the exchange server. Although if you are opening the Exchange Management Shell then there is no need to add this snapin. It gets loaded by default. You only need to do this command if you want to run the exchange cmdlets in a regular powershell window.

Will.
0
 

Author Comment

by:joestramandinoli
ID: 39725437
Excellent. Thanks Will.

I will give it a try tonight.

Joe
0
 

Author Comment

by:joestramandinoli
ID: 39728346
Hi Will,

I keep getting stuck at the Export-Mailbox part of the script saying that it isn't a recognized cmdlet.

I have even tried running Exchange Management Shell & importing the modules.

I am really needing to get this to work and appreciate your help and everyone else's help so far, but if anyone has any other things I could try I would be most grateful.

Thanks

Joe
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39728353
Not sure what is wrong with your ESM. They should load automatically. You can try running Get-pssnapin and this command will tell you what cmdlets are installed.

Will.
0
 

Author Comment

by:joestramandinoli
ID: 39728376
Hi Will,

Here is the screenshot from PS & EMS

Thanks

Joe
IT3.docx
0
 

Author Comment

by:joestramandinoli
ID: 39775388
Hi - Is anyone able to help?

Thanks

Joe
0
 
LVL 53

Assisted Solution

by:Will Szymkowski
Will Szymkowski earned 500 total points
ID: 39775609
For whatever reason you do not have the Exchange Management Snapin. See the screenshot below...
The screenshot below shows for Exchange 2007. The below command will show you how to install the snapin for Exchange 2010.
pssnapins
You need to run the following command...

add-pssnapin microsoft.exchange.management.powershell.e2010

You will then be able to run the above commands i have specified in the earilier posts.

Will.
0
 

Author Comment

by:joestramandinoli
ID: 39776228
Hi Will,

Thanks for responding but I am still having issues.

I ran the command that you mentioned and it seemed to have worked so I continued on to try run that script that you initially posted but I have received the same error message.

Please see the attached screenshots.

Thanks Will.

Joe
ss1.png
ss2.png
0
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 500 total points
ID: 39776641
My fault. I just looked at the error message and in my original post I provided a PS script that works with Exchange 2007. You are using Exchange 2010. Below is the syntax you want to use. Export-mailbox has been removed from Exchange 2010 which is why you are getting that error message you've posted.

CSV Format
sAMAccountName     Access         location
jsmith                            jbryant          \\servername\sharename\jsmith.pst
hsmyth                          jbryant          \\servername\sharename\hsmyth.pst
etc...



Powershell Command
$Userlist = Import-Csv "c:\yourCSVhere.csv"
foreach ($Perm in $Userlist) {
$Perm.sAMAccountName
$Perm.Access
Add-MailboxPermission -Identity $Perm.sAMAccountName -User $Perm.Access -AccessRights FullAccess -InheritanceType All
}
$Userlist = Import-Csv "c:\yourCSVhere.csv"
foreach ($User in $Userlist) {
$User.sAMAccountName
$User.Location
New-MailboxExportRequest -Mailbox $User.sAMAccountName -filepath $User.Location
}

Open in new window


You still need to have full mailbox access to export the mailboxes. which is the first part of the script. You have to add an additonal column called Locaiton with the \\servername\SAHRENAME\Filename.pst. This has to be a Shared folder.

You can then track the progess of the exports using the below command

get-New-MailboxExportRequest

Open in new window


This will display the status/progress of the mailbox.

Will.
0
 

Author Comment

by:joestramandinoli
ID: 39792010
Hi Will,

Thanks for that new script.

I have just tried it and get the following error:

Cannot validate argument on parameter 'FilePath'. The argument is null. Supply a non-null argument and try the command
again.
    + CategoryInfo          : InvalidData: (:) [New-MailboxExportRequest], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,New-MailboxExportRequest

I have created a share which I would like the pst files to go and have given "everyone" full control access on both share and file permissions.

Thanks Will.

I really appreciate your help this far!

Joe
0
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39792153
Try doing the command for one rather than using the script, just to see if it works. I had tested this in my lab and everything was fine for me. You need to make sure that the name is also included in the UNC path (\name.pst).

Single example below...

New-MailboxExportRequest -Mailbox <mailboxID> -filepath "\\servername\sharename\testuser.pst"

If that works then might be your CSV format with the script.

Will.
0
 

Author Comment

by:joestramandinoli
ID: 39793319
Hi Will - Your an absolute LEGEND!

I forgot to rename the new CSV file with the location column when I placed it into the new script.

It is working like a charm now.

Thanks for all your help!

Joe
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
In this video we show how to create a User Mailbox 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 Recipients >> Mailb…
how to add IIS SMTP to handle application/Scanner relays into office 365.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now