This week I was working on a project to clean up a ton of inactive accounts/mailboxes in our Exchange organization that were just sitting there talking up gigs upon gigs of disk space. The problem was, there were over 400 of these accounts and management needed PSTs of the mailboxes for ongoing projects.
Luckily, PowerShell makes it fast and easy to export all these mailboxes in one shot.
First, create a CSV of aliases that you need to export, with "Alias" as the heading of the column and a filename of aliases.csv.
**Note** If you already have a list of display names, you can follow my previous post to generate a new CSV with the aliases.
Then, copy the text below and save it as a .ps1 file (name it whatever you want to call it, preferably something like BulkPSTExport.ps1) and save it in your preferred location.
foreach ($mbx in (Import-Csv C:\aliases.csv)) {
New-MailboxExportRequest -Mailbox $mbx.Alias -FilePath "\\server\share_pst\$($mbx.Alias).pst"
}
**Note** Change the location of the aliases.csv file to where you saved it, and the \\server\share path to your fileserver location.
**Note** You cannot export PST's to a local drive on the Exchange server, it must be a remote location
Fire up the Exchange Management Shell (EMS) and cd to the location that you saved your new .ps1 file, and run:
.\BulkPSTExport.ps1
The PST exports will queue up and they'll then start creating PST's in the location you specified in your script. You can check the status of the exports, but with this many I would just want to see how many are completed. To do that just run:
Get-MailboxExportRequest | where {$_.status -eq "Completed"}
No comments:
Post a Comment