Created
March 20, 2014 16:38
-
-
Save iqwirty/9668136 to your computer and use it in GitHub Desktop.
Gets Exchange mailbox statistics for a list of users specified in a text file. Writes the statistics to an output .csv file.
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
# Load the Exchange management cmdlets. | |
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin | |
Add-PSSnapin Microsoft.Exchange.Management.Powershell.Support | |
# Import all the modules located in: | |
# %windir%\System32\WindowsPowerShell\v1.0\Modules | |
ImportSystemModules | |
$usersFromFile = Get-Content "users.txt" | |
$userstats = @() | |
ForEach ($u in $usersFromFile) | |
{ | |
Write-Host "Processing $u..." | |
$foundUserStats = Get-MailboxStatistics $u | ` | |
Select DisplayName, TotalItemSize, ItemCount, ServerName, StorageGroupName, Database | |
$userstats = $userstats + $foundUserStats | |
} | |
$userstats | Export-Csv -Path "userstats.csv" -notype |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment