PowerShell script to Export Exchange 2010 Mailboxes to PST files

by Stan Czerno September 3, 2015 07:30 CST

I have been using Steve Goodman's script in my Lab for sometime now and I decided to spice it up a bit. Since I really cannot afford true Brick-Level backup software for Exchange in my lab, between VM Exports/Backups and this Script, my Exchange Server is protected good enough.

Steve's script basically Exports all Mailboxes to a PST on a File Server Share you define, one PST per Mailbox. My version of the Script creates a folder for the current Year-Month and exports to it. For example, if the month is September and the year is 2015, the script creates a folder named "2015-09".

It also checks to see if a folder exists from 13 months ago and deletes it, essentially leaving me with a year's worth of exports. For example, if the month is September and the year is 2015, the script looks to see if there is a folder named 2014-08 and deletes it if it exists.

My version will also Email results of the export, showing you how many mailboxes were found and how many were successful as well as any failures or missed mailboxes.

I schedule this script to run twice per day.

Have a look and let me know what you think.

I am going to regurgitate some of Steve's instructions, but I would suggest you visit his Blog to read more: http://www.stevieg.org/2010/07/using-the-exchange-2010-sp1-mailbox-export-features-for-mass-exports-to-pst/

Getting it set up

The basic requirements for using the new feature are pretty straightforward. You need to use an account that’s a member of the organizational management groups, and have the “Mailbox Import Export” role assignment assigned to you or a role group you’re a member of. As the export is done at a CAS server (and if you’ve multiple CAS servers you can’t specify which one in each site will be used) you can’t specify a local drive letter and path – you must specify a UNC path to a network share that the "Exchange Trusted Subsystem" group has read/write access to.

Step One

Create a share on a server, and grant Exchange Trusted Subsystem read/write permission. In this example I’m using a share called Exports on a test server called Azua in my lab environment:


Step Two

Next, you’ll need to grant a user, or group, the Mailbox Import Export role assignment. You can do this using the Exchange Management shell with a single command. In this example, I’m granting my lab domain’s Administrator user the role assignment:


New-ManagementRoleAssignment –Role "Mailbox Import Export" –User AD\Administrator

Tags: ,

Catergories: Exchange Server | Powershell

Comments are closed