Exchange PowerShell: How to get list of mailboxes, folders, subfolders, items in folder, foldersize programmatically?

One of my customer automated Exchange PowerShell with his .Net application. They had a requirement to enhance the functionality – to get the list of exchange mailboxes, folders and its sub folders, items in folder, foldersize. Finally it needs to be saved in .csv format. 
To implement this, we used Get-Mailbox and Get-MailboxFolderStatistics Exchange cmdlets. For looping the objects, we used foreach-object and couple of pipes to achieve the goal.

PowerShell (screenshot):

Exchange PowerShell

PowerShell (script) – adding for your reference:

[PS] C:\Documents and Settings\Administrator>Get-Mailbox | Select-Object alias | foreach-object {Get-MailboxFolderStatistics -Identity $_.alias | select-object Identity, ItemsInFolder, FolderSize} | Export-csv c:\Stats.csv -NoTypeInformation



As you know you can automate your application using .Net programmatically by referring the following articles: and

Happy programming!!

Comments (3)
  1. kirandudala says:


    How can we find single mail id or single mail message id which is in formate "0000003D762900000000003DDFD50000"?



  2. Jimmy says:

    can i go against Get-Mailbox -organizationalunit and also output the mailbox attribute such as email address, display name ?

  3. alindzon says:

    what about the office365 archive folders, how do I access them?

Comments are closed.

Skip to main content