Skip to content
September 29, 2010 / dw

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(“wscript.shell”)
vpsscript = “powershell.exe -noexit d:\getdatabasesize.ps1”
objshell.run vpsscript

Hope it Helps

dw

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: