Tuesday, November 23, 2010

MS: Get Exchange Mailbox Info (Exchange 2007 / 2010 or later)

This PowerShell script show the size of the Inbox folder and export the result to CSV file (excel)

Get-Mailbox foreach { $mbx = $_.DisplayName; Get-MailboxFolderStatistics $_.identity -FolderScope 'Inbox' select @{n="DisplayName";e={$mbx}},FolderPath,ItemsInFolder,@{n="FolderSize(MB)";e={$_.folderSize.toMB()}}} export-csv c:\Inbox.csv

This is another script to show the size of the Inbox folder and export the result to CSV file (excel)

Get-Mailbox -ResultSize Unlimited Select-Object Name, @{n='Inbox';e={(Get-MailboxFolderStatistics $_.Identity -FolderScope Inbox).FolderAndSubfolderSize.ToMb() }} Export-Csv c:\Inbox.csv -NoTypeInformation

No comments: