In this guide we will create and schedule a task that runs a script that will read a mailbox database in Exchange 2013, then export the contents of the mailbox database to pst. This script can also be used to manually export pst`s from a mailbox database store. I will also show you the command to export an individual mailbox to pst in Exchange 2013. This guide will also work for Exchange 2010 and Exchange 2007 as it uses the standard Windows Task Scheduler.This is also know as pst mass export. If the user you are logged in as does not have permissions to use the import and export commands then here is how to enable the export mailbox commands in Exchange 2013.
Exchange 2013 Script To Export PSTs
Ok, the first command I will show you is to export an individuals pst, if you wanted to schedule this command you will need to create it it notepad and save it as a batch file (for example “export.bat” ).
New-MailboxExportRequest -Mailbox "Allen White" -FilePath \\MyServer\MyShare\AllenWhite.pst
The command above Exports the user mailbox Allen White to the specified the path to a pst. Remember save the command to a batch file if you want to schedule it as I will show you in a later step.
Now we will export a whole mailbox database to pst with the command below.
Get-MailboxDatabase \\YourServerName\YourDataBaseName | Export-Mailbox –PSTFolderPath <Path where you would like to export to> -Confirm $false
That command exports every mailbox from the chosen server from the chosen database to the specified path. The False command stops you having to OK when it moves onto each mailbox. Again save it as a batch file if you want to schedule it.
Schedule A Task To Export Mailboxes To PST
Now we will create the scheduled task to run the batch file we have created. We need to run Task Scheduler which is under Administrative Tools.
We are now going to create a basic task, follow the below. We first click Action then Create Basic Task. Once done decide on the tasks name and give the task a good description. Then click next.
Then you need to select the frequency of the task, choose as required.
Again now select what time you would like the task to run.
As we have saved our commands to a batch file we are going to select “Start a Program”, do so and point it to the batch file that you created.
Here is my PST Export Batch File.
Finally we see the summary for the task we have created. The task will now export your pst`s from your selected mailbox at the time specified to the folder specified. This is now complete.