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


                    Le Café Central de
Deva              

                                 
                                 ..... Deva blogs!!




 

 

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

  • Comments 2

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

Result:

Output

As you know you can automate your application using .Net programmatically by referring the following articles:http://msdn.microsoft.com/en-us/library/bb332449(v=exchg.80).aspx and http://msdn.microsoft.com/en-us/library/ff326159(v=exchg.140).aspx.

Happy programming!!

  • Hi,

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

    Thanks,

    Kiran!

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

Page 1 of 1 (2 items)
Blog - Post Feedback Form(CAPTCHA)
Leave a Comment
  • Post