com .
Creating reports for mailbox size has always been a center of contention in the Exchange administrators
communities. The debate has now changed from how to create the report into how detailed to make the report
now that the tools are available.
Getting the Database File Size
Another interesting script that can be used to show off some of these PowerShell techniques is getting the
database file sizes on disk. This script would be useful when determining backup sizing, or storing the data
to trend file growth:
$server = [System.Environment]::MachineName
$db = get-MailboxDatabase -server $server
foreach ($objItem in $db)
{
$dbsize = get-childitem $objItem.EdbFilePath
Write-Host ???Server\StorageGroup\Database??? $objItem.Identity
Write-Host ???Size(KB)??? $dbSize.Length
}
The first thing this script does is obtain a list of all of the mailbox stores on the server. Then for each
mailbox store you cycle through a foreach loop and get the file path for the database. Then you return
the mailbox store identity and the length of the file. You are returned a result set like the one in Figure 16-11.
Figure 16-11
Chapter 16: Reporting, Maintenance, and Administration
481
The result set that is returned is pretty ugly and difficult to read. It would be better to return the result
in a table.
Pages:
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668