Exchange Server 2010 export all mailboxes with powershell

This is a follow up post to my existing post about exporting mailboxes to pst with powershell. As requested i modified the script a bit to export all mailboxes to pst files with a single script.

Just fill in the variables need wich are in the first lines of the script.

$mailserver = "<servername>"
$path = "\\<servername>" 
$userlist = get-mailboxdatabase -server $mailserver | get-mailbox

 foreach ($user in $userlist)
  $useralias = $user.alias
  New-MailboxExportRequest -Mailbox $useralias -FilePath $path\PST$\$user.pst

This script could even be scheduled to make an export on specific times/days/dates.

Check Also

VMware Certified Professional – Recertification every 2 years

VMware has made some important changes to it’s certifications, this is probably affected most VCPs! …


  1. Hello, I try this script and it’s works fine but it should get users aliases but it takes full user name instead and create .pst file with it.

  2. I hope i understand your question correctly … my guess is that you would like the pst name to be the alias name instead of the username. Ifso, you just have to set that on the last word of the script

    $user.pst has to be $useralias.pst

    let me know!

  3. Yes, it was so easy. Shame on me 😉 Thaks for your help.

  4. Is it possible to mass export these mailboxes to a folder named I have the same script which we use currently in exchange but I cannot for the life of me figure out how to export the files to $path\pst$\$user\$user.1.pst

    I am trying to do this to make a ingestion process simpler. I already have the folders created just trying to find a way to export them to a folder with the users name and dump the pst file with a .1.pst extension. Any help or suggestions are appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *