Advertisement
Guest User

Untitled

a guest
May 28th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Loop through each of the databases
  2.     Foreach ($database in $databases) {
  3.              
  4.               {
  5.                      # Get the database size summing the size of all mailboxes and "Deleted Items" in the database
  6.                      $dbsize = (Get-MailboxStatistics -Database $database.Identity  | Measure-Object -Property TotalItemSize,TotalDeletedItemSize -Sum).Sum
  7.               }
  8.  
  9.               # Compare the sizes to find the smallest DB
  10.               if (($dbsize -lt $smallestdbsize) -or ($smallestdbsize -eq $null)) {
  11.                      $smallestdbsize = $dbsize
  12.                      $smallestdb = $database  
  13.               }
  14.              
  15.        }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement