Get the Exchange Database Size using Powershell Script

Calculate Database Size
Sometime we needs to Calculate the size of all the mailboxes in the DB,
Below Powershell script can be used to get the same,  add it to your function module to Quickly access it as CMD.

Usage:

PS>GetTotalDBSize TestDB

Total Database Size: 1.76 GB


Function GetTotalDBSize 
 {
  Param ($database)
  $mbxs = Get-MailboxStatistics -Database $database
$A=[int](($mbxs | % {$_.TotalItemSize.Value.toKB()}) | measure -Sum).Sum/1024/1024
Write-host "Total Database Size:"([math]::Round($a,2))"GB"
 }

Comments