Solutions Through IT

April 5, 2012

Powershell Play–Exporting mailboxes from an SBS Server (2008)

Filed under: Powershell, SBS, SBS 2008 — solutionsthroughit @ 12:42

I’m starting to have a play with powershell, as I’ve now got the requirements to start using it.  I’m impressed, I knew it was powerful, but as I hadn’t had a play yet, I’m still in “first looks” awe B)

I found this blog, which looked like it would happily help me export all my mailboxes, however, the export all mailboxes command was failing on my SBS 2008.

It was correct, the requirements for performing the export:

  • Outlook (32Bit version, 2003 or 2007).  I do not know if this will work with 2010.
  • Exchange 2007 Management Tools (Download the appropriate version from here)

I had to add permissions  to all accounts to the administrator account I was exporting with, so the following command added those permissions, substituting YourAdminUsername with your Admin username (surprisingly enough).

Get-Mailbox | Add-MailboxPermission –user YourAdminUsername –AccessRight FullAccess –Inheritancetype all

This command

Get-User | where { $_.Title –like “*” } | Export-Mailbox –PSTFolderPath C:\MyPSTExport

worked, but had a good number of errors, as it returned ALL accounts, whether or not they had a mailbox.  A better use for this specific case is where you want to export some  This command

Get-User | where { $_.RecipientType –like “UserMailbox” } | Export-Mailbox –PSTFolderPath C:\MyPSTExport

did the job perfectly.  This filtered only the users with mailboxes, and exported their contents.

Hopefully, I won’t have to be doing a bulk import, so won’t do a direct follow up to this 🙂

Update: Still looking for a “refresh PST” option, but have got a filter, that will allow exporting any changes, after a date – adding –StartDate YYYY/MM/DD as the last argument of the Export-Mailbox command, will allow you to export mail items created or MODIFIED after this date.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Blog at

%d bloggers like this: