Export multiple mailboxes with a powershell script

Need to take a copy of multiple mailboxes? I’ve had to do this in the past for various reasons such as audit/investigations etc. You’ll need to create a .csv file with the list of mailboxes you want to export. Then save the script below in a .ps1 file and store it in the same location as the .csv. You can then simply open Powershell and execute the script.

$Date = Get-Date -format “yyyyMMdd”

foreach ($user in (Import-CSV “export-mailboxusers.csv”)) { Export-Mailbox “$($user.Username)” -PSTFolderPath “M:MailboxBackups$($user.Username)_$($Date)_Mailbox.pst” -Confirm:$false }

This will work through the csv file and export the mailbox to the path specified (M:Mailboxbackups in this example). The name of the file is formed from the mailbox name, date and the word mailbox i.e. Peter Egerton_20110802_Mailbox.pst. The date format can be amended as required in the first line.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.