Friday, January 20, 2012

Get-MailboxDatabase Size list

Exchange 2007

There are a couple methods you can use to get this information in Exchange 2007. Here is a great example posted by Gary Siepser; it's a one-liner that retrieves the database size using WMI, allowing you to run it against clustered mailbox servers:
Get-MailboxDatabase | foreach-object {add-member -inputobject $_ -membertype noteproperty -name mailboxdbsizeinGB -value ([math]::Round(([int64](get-wmiobject cim_datafile -computername $_.server -filter ('name=''' + $_.edbfilepath.pathname.replace("\","\\") + '''')).filesize / 1GB),2)) -passthru} | Sort-Object mailboxdbsizeinGB -Descending | format-table identity,mailboxdbsizeinGB

Exchange 2010

Fortunately, the Get-MailboxDatabase cmdlet in Exchange 2010 provides this information for us out of the box. All you need to do is use the Status parameter and you can access the information using the DatabaseSize property. Here is an example:
Get-MailboxDatabase -Status | select ServerName,Name,DatabaseSize

No comments:

Post a Comment