Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Loop through each of the databases
- Foreach ($database in $databases) {
- {
- # Get the database size summing the size of all mailboxes and "Deleted Items" in the database
- $dbsize = (Get-MailboxStatistics -Database $database.Identity | Measure-Object -Property TotalItemSize,TotalDeletedItemSize -Sum).Sum
- }
- # Compare the sizes to find the smallest DB
- if (($dbsize -lt $smallestdbsize) -or ($smallestdbsize -eq $null)) {
- $smallestdbsize = $dbsize
- $smallestdb = $database
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement