From time to time I receive a support ticket to restore a mailbox folder or items because they have gone missing. In literally 99% of cases the missing mailbox contents can be found by using a search, avoiding the need to perform a mailbox recovery. Often the cause of the missing folder or items is that they have simply been moved to another folder in the mailbox by accident.

One of the search techniques I use involves the Get-MailboxFolderStatistics cmdlet.

You may be wondering why I’m not using the Get-MailboxFolder cmdlet instead. The answer is that the Get-MailboxFolder cmdlet works when the mailbox owner runs it. This is explained in more depth here.

Anyway, Get-MailboxFolderStatistics works perfectly fine for this type of scenario where you are looking for a folder name.

Let’s say that a customer reports they are missing a folder named “Invoices”. You can perform a Get-MailboxFolderStatistics query for mailboxes that match the name “Invoices”, for example:

[PS] C:>Get-MailboxFolderstatistics -Identity alan.reid | Where {$_.Name -Match "Invoices"}

If there are any matches you’ll see a result such as this:

RunspaceId                        : 13f46c2a-fe30-4a26-aaf3-35802e4844b8
Date                              : 22/01/2013 10:35:05 PM
Name                              : Invoices
FolderPath                        : /Folders/Project Matters/01. Construction/Invoices
FolderId                          : LgAAAVBUeIJL9KbERYxlSZYX1as2AQAe/v3fqiJWHJJazVoxVJTnACsOCIAqAAAB
FolderType                        : User Created
ItemsInFolder                     : 34
DeletedItemsInFolder              : 0
FolderSize                        : 3.516 MB (3,686,955 bytes)
ItemsInFolderAndSubfolders        : 34
DeletedItemsInFolderAndSubfolders : 0
FolderAndSubfolderSize            : 3.516 MB (3,686,955 bytes)
OldestItemReceivedDate            :
NewestItemReceivedDate            :
OldestDeletedItemReceivedDate     :
NewestDeletedItemReceivedDate     :
OldestItemLastModifiedDate        :
NewestItemLastModifiedDate        :
OldestDeletedItemLastModifiedDate :
NewestDeletedItemLastModifiedDate :
ManagedFolder                     :
TopSubject                        :
TopSubjectSize                    : 0 B (0 bytes)
TopSubjectCount                   : 0
TopSubjectClass                   :
TopSubjectPath                    :
TopSubjectReceivedTime            :
TopSubjectFrom                    :
TopClientInfoForSubject           :
TopClientInfoCountForSubject      : 0
SearchFolders                     : {AllItems, Reminders, To-Do Search, Restriction(1-61B5D4A3), Tracked Mail Processin
                                    g}
Identity                          : alan.reidFoldersProject Matters

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Pak Mega Place (www.pakmegaplace.com)

    Thanks, useful information 🙂

  2. JohnM

    HI All –

    Great little script…using the example listed on article, how about listing ALL the subfolders for that particular folder.
    For example: we are looking for folder “Invoices” and also what subfolders does “Invoice” have within it.

    Thanks.
    JohnM

  3. Chamu

    Thank you so much it is very useful. Is there any way that one particular folder that it should not get deleted, can we secure folder without deleting ?

  4. SANKARASUBRAMAN PARAMESWARAN

    how i can execute the query to find the exact no of emails in the folder with the specified date.

  5. Alon

    Can you do this also when searching for folders with non English language ?
    when i run the command i get unreadable results with random characters

  6. Caroline

    I have found this useful, thank you, but I’m also trying to discover if there is a way to move a folder out of Deleted Items and back under Inbox using PowerShell. Do you know if this can be done?

  7. KingKong

    Thank you for sharing the tips. I am looking for some help to make sure all EndUser and Shared Mailboxes have a Specific Folder (e.g. YourStorage folder) in their Mailbox and have to have “Never Delete” retention Tag assigned on them.
    As a separate task, if there are any mailbox that doesn’t have the folder or tag assigned then create the folder and assign tag to them.

    Any thoughts?

  8. Tom

    Every single day.

    I like to use:
    get-mailboxfolderstatistics -identiy user | select folderpath

    To give me a overview of a users entire folder structure. It’s also helpful when the user doesnt know the name of the folder that they are missing.

Leave a Reply