Get a List of Mailbox Folders Sorted by Size

Filed in Microsoft Exchange 2010, Microsoft Exchange 2013, PowerShell

It doesn’t matter if an end user gets so much email that it’s impossible to manage, gets a lot of really important email that can’t be deleted, or is just really bad at managing their stuff, many end users will always complain about not having enough storage space for their mailbox. We all know the standard instructions: Configure auto-archiving or online archiving, save attachments separately and remove them from the original messages, etc. But generally it usually comes down to one real solution: delete large and unneeded emails.

“But how do I find the large emails?”

Outlook has some great built-in search features that let you find all emails over a certain size, and that’s a great answer for some users. Other users are on a Mac. In my opinion, there are no good answers for them except to run Outlook 2013 in Parallels. Outlook 2011 and Mac Mail are far too error prone and unstable to be a reliable Exchange client. Here’s one thing that can really help those Mac users–and even PC users–focus their mailbox cleanup efforts.

You can run this script from the Exchange Management Shell and tell them exactly which folder contains the lion’s share of email. Save it as “Get_Folders.ps1″ (or whatever you want to call it) under C:\Windows\system32\WindowsPowerShell\v1.0> and enter it with a mailbox name as a command line switch. If you enter it without a mailbox name, it will remind you and give you some instructions.

if (($Username -eq $Null) -or ($Username -eq "")) {
     [console]::ForegroundColor = "yellow"
     write-host " "
     write-host "Syntax: Get_Folders <username>"
     write-host " "
     write-host "Username can be an alias, primary SMTP, UPN, etc."
     write-host " "
     [console]::ForegroundColor = "white"

Get-MailboxFolderStatistics $Username | sort-object `
     foldersize -descending | ft folderpath, foldersize, `
     itemsinfolder -autosize

The output will look something like this:

FolderPath             FolderSize                   ItemsInFolder
----------             ----------                   -------------
/Inbox/Stupid stuff    1.115 GB (1,196,735,329 bytes)       14471
/Inbox                 196.2 MB (205,723,806 bytes)          4491
/Deleted Items         133.8 MB (140,254,956 bytes)          2095
/Sent Items            111.8 MB (117,249,782 bytes)          1929
/Deletions             62.59 MB (65,627,090 bytes)           1640
/Conversation History  42.14 MB (44,182,985 bytes)            977
/Calendar              9.079 MB (9,520,300 bytes)             417

From this you can tell the user that either they should probably take a look at that “Stupid Stuff” subfolder under the Inbox. There might be a few items there that they could stand to delete.

Click to view/hide

Fix Synchronization Errors in Outlook 2010

Filed in Outlook 2010

Actually, I’m not going to tell you how to fix them because that’s usually not necessary. I’m just going to tell you how to hide them.

Frequently when an Outlook user has been upgraded from Office 2007 to Office 2010, he will begin to see messages similar to this one in his Unread Mail search folder:


From: John Smith
Sent: Monday, September 15, 2014 11:21 AM
To: John Smith
Subject: Synchronization Log:
Importance: High11:20:03 Synchronizer Version 14.0.7108
11:20:03 Synchronizing Mailbox ‘John Smith’
11:20:03 Synchronizing local changes in folder ‘Some folder’
11:21:08 Error synchronizing folder
11:21:08 blah…blah…blah…


Most of the time, these synchronization errors are the result of momentary network connection problems or who knows what, but they rarely tell you anything useful unless there is an actual problem that you are trying to solve. Unfortunately, telling that to the end user doesn’t provide them with much in the way of comfort or closure.

Here’s how to fix it.

  1. In Outlook 2010 right-click on the “Unread Mail” search folder and select “Customize This Search Folder…”
  2. In the Custom Search Folder window, make sure that the Name field says “Unread Mail” and click on the Browse button.
  3. In the Select Folder(s) window, uncheck all folders except for the Inbox. If the end user has created rules that move new emails into any other folder, you might want to include those also. Whatever you do, make sure you uncheck the Sync Issues folder. There is no reason anyone who isn’t clinically masochistic would want that included in a search folder.

Click OK, and OK, and, like magic, all the synchronization errors are gone.

Well, not gone. Just no longer giving the end user that uneasy feeling that he might not be getting all his email.

Click to view/hide

List Mailbox Databases in Order of Size

Filed in Microsoft Exchange 2010, Microsoft Exchange 2013, PowerShell

This is a quick and easy cmdlet for listing all of your mailbox databases in order of size.

Get-MailboxDatabase -Status | Sort-Object DatabaseSize | FT Name, DatabaseSize, Server

Click to view/hide
Click to view/hide