Server 2003 – Exchange 2007 Export/Archive Mailboxes Before Migrating To Office365

End Goal: Migrate to O365

Problem: A ridiculous amount of accounts to archive that we will not be migrating.

Solution: Powershell

Pre-reqs:

  • A 32-Bit Machine (I used a Win 7 VM x32) YES IT NEEDS TO BE X32 DUE TO ARCHITECTURE LIMITATIONS
  • Exchange management console x32 (You can do a custom install from the exchange 2007 install files, just select custom install not full)
  • Outlook 2007 installed (just google the ISO)
  • A list of usernames in CSV format (I took a user list from an XLSX and turned it into CSV in preperation for powershell) (with the header of name)
  • A file share with proper permissions so we can store the PSTs somewhere
  • The script below needs to run from the exchange management shell of the x32 bit computer

 

An example of how the CSV should be:

Name,
firstname lastname
firstname2 lastname2

In reality you should already have a list of the users to be archived by filtering through powershell and exporting to CSV.

A walk through of how the script works:

Import the CSV into a variable, give yourself full permission to all the mailboxes, export each mailbox’s inbox to the server’s file share, no need to confirm each account, and if it errors out just continue

The Powershell script:

$accounts = import-csv C:\accounts-to-archive.csv
$accounts | select -expand name | foreach-object {get-mailbox -identity “$_” | add-mailboxpermission –user myadminacc -accessrights Fullaccess }
$accounts | select -expand name | foreach-object {export-mailbox -identity "$_" -includefolders "\Inbox" -pstfolderpath "\\server\archived$\$_.pst" -Confirm:$false -ErrorAction silentlycontinue }