Created
January 13, 2015 16:09
-
-
Save Grimthorr/d2ac246f204ee15503b6 to your computer and use it in GitHub Desktop.
Generate a CSV report detailing the total size of and number of items in each Exchange user's Deleted Items folder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
echo "Generating report for deleted items folders..." | |
echo "Please wait..." | |
$data = @() | |
foreach($mbx in Get-MailboxDatabase | Get-Mailbox) { | |
$dispname = $mbx.displayName | |
$data += Get-MailboxFolderStatistics $mbx.identity | where{$_.FolderType -eq "DeletedItems"} | Select-Object @{n="Username";e={$mbx.displayName}}, @{n="TotalSizeIncSubfolders(MB)";e={$_.FolderAndSubFolderSize.ToMb()}}, ItemsInFolderAndSubFolders | |
} | |
echo "Exporting report to C:\Temp\exchange-report-deleted-items.csv..." | |
$data | Sort-Object "TotalSizeIncSubfolders(MB)" –Descending | Export-Csv C:\Temp\exchange-report-deleted-items.csv | |
echo "All done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment