Quota if Mailbox Measurement script for Alternate 2010,2013

Quota if Mailbox Measurement script for Alternate 2010,2013 In case your taking part in round with completely different Mailbox quota values you would possibly wish to see what the utilization of these quotas could be earlier than you apply them to a Mailbox. This can be a quite simple Mailbox Measurement script for Distant Powershell to point out you this with a cool console graph output (and a CSV report) eg

So what the script does is the traditional Get-Mailbox | Get-MailboxStatistics to get the TotalSize of the Mailbox in MB and compares that towards a QuotaIf Worth you feed into script within the above instance that was 2000 MB. It then works out the present proportion used and the produces an Alt-ASCII graph and the above desk.

If you run this script you’ll want to feed within the QuotaIf worth eg

.quotaIf.ps1 2000

I’ve put a download of this script right here and code itself seems like

  1. $QuotaIfVal = $args[0]  
  2. $Script:rptCollection = @()  
  3. get-mailbox -ResultSize limitless| Get-MailboxStatistics | foreach-object{  
  4.     $rptObj = “” | Choose MailboxName,TotalSize,QuotaIfPercent,PercentGraph  
  5.     $rptObj.MailboxName = $_.DisplayName  
  6.     [Int64]$rptObj.TotalSize = ($_.TotalItemSize.ToString() |%{($_.Substring($_.indexof(“(“)+1,$_.indexof(“b”)-$_.indexof(“(“)-2)) -replace(“,”,“”)})/1MB  
  7.   
  8.     $rptObj.QuotaIfPercent = 0    
  9.     if($rptObj.TotalSize -gt 0){  
  10.         $rptObj.QuotaIfPercent = [Math]::spherical((($rptObj.TotalSize/$QuotaIfVal) * 100))   
  11.     }  
  12.     $PercentGraph = “”  
  13.     for($intval=0;$intval -lt 100;$intval+=4){  
  14.         if($rptObj.QuotaIfPercent -gt $intval){  
  15.             $PercentGraph += “▓”  
  16.         }  
  17.         else{         
  18.             $PercentGraph += “░”  
  19.         }  
  20.     }  
  21.     $rptObj.PercentGraph = $PercentGraph   
  22.     $rptObj | fl  
  23.     $Script:rptCollection +=$rptObj   
  24. }  
  25. $Script:rptCollection  
  26. $Script:rptCollection | Export-Csv -NoTypeInformation -Path c:tempQuotaIfReport.csv -Encoding UTF8   

Leave a Reply