Monday, May 19, 2014

Exchange 2010 - Random Scripts 4

Powershell script to pull and display Database sizes with results sorted by size, greatest to least.



##Script to return mailbox database name and size in GB
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

No comments:

Post a Comment