PowerShell: Exchange 2007 mailbox database details V3
[array]$MailboxDatabaseTable = @()
$dbs = Get-MailboxDatabase -status
foreach ($db in $dbs)
{
if ($db.Mounted -eq “True”)
{
$dbstats = Get-MailboxStatistics -database $db
$totaldbsize = 0
$totalmbcount = 0
foreach ($dbstat in $dbstats)
{
$totalmbcount = $totalmbcount + 1
$totaldbsize = $totaldbsize + $dbstat.TotalItemSize.Value.ToMB()
}
[psobject]$MailboxDatabaseRow = new-object ‘psobject’;
Add-Member -inputObject $MailboxDatabaseRow -type noteproperty -name ‘Identity’ -value $db.Identity.ToString();
Add-Member -inputObject $MailboxDatabaseRow -type noteproperty -name ‘TotalMB’ -value $totalmbcount;
Add-Member -inputObject $MailboxDatabaseRow -type noteproperty -name ‘TotalSize’ -value $totaldbsize;
Add-Member -inputObject $MailboxDatabaseRow -type noteproperty -name ‘SendQuotaMB’ -value $db.ProhibitSendQuota.Value.ToMB();
Add-Member -inputObject $MailboxDatabaseRow -type noteproperty -name ‘ReceiveQuotaMB’ -value $db.ProhibitSendReceiveQuota.Value.ToMB();
Add-Member -inputObject $MailboxDatabaseRow -type noteproperty -name ‘WarningQuotaMB’ -value $db.IssueWarningQuota.Value.ToMB();
[array]$MailboxDatabaseTable += , $MailboxDatabaseRow;
}
}