Check Database Sizes with PowerShell

Exchange 2007 check the database size with a powershell ps command.

I found this from Mike Pfeiffer’s Blog – thanks Mike.

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

Leave a Reply

Your email address will not be published. Required fields are marked *