Get Exchange Mailbox database sizes and sort so smallest is on top.

get-mailboxdatabase | foreach-object{select-object -inputobject $_ -property *,@{name=”MailboxDBSizeinGB”;expression={[math]::Round(((get-item (“\\” + $_.servername + “\” + $_.edbfilepath.pathname.replace(“:”,”$”))).length / 1GB),2)}}} | Sort-Object mailboxdbsizeinGB | format-table identity,mailboxdbsizeinGB –autosize

the output give a complete list of databases and puts the smallest one on top.

and if you want to simply double click a vbscript, here is a script “getdatabasesize.vbs” that calls the ps1. Its a little more user friendly. This is simply a vb script to call the powershell script.

Make sure you change the d:\ to the path its at.

code is

set objshell = createobject(“”)
vpsscript = “powershell.exe -noexit d:\getdatabasesize.ps1” vpsscript

Hope it Helps



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s