Exchange : Database Sizing Scripts
I’ve recently been asked to size some Exchange 2007 environments for migration to Exchange 2010; specifically database sizes. I used the following scripts to perform this task.
Export User Mailbox Sizes
This script will give you an idea of allocated storage, regardless of Single Instance Storage – this is important as Exchange 2010 no longer includes Single Instance Storage. Microsoft suggest that you should allow a 15% increase in storage, in reality I’ve found this to be a very accurate figure to go by. Change the server name in the script an you’re good to go.
{code lang:css showtitle:false lines:false hidden:false}Get-MailboxServer <server name> | Get-MailboxStatistics | Sort -Property TotalItemsize | select-object DisplayName, LastLoggedOnUserAccount, ItemCount, @{name=”Size(MB)”;expression={$_.totalitemsize.value.ToMB()}} | export-csv stats.csv{/code}
Find Database File Size
This script will show the physical file size of each database. Remember this will not give an indication of the true data size of all user mailboxes, unless you add approx 15% to the size (YMMV). Again, change the server name.
{code lang:css showtitle:false lines:false hidden:false}Get-ExchangeServer <server name> | Get-MailboxDatabase | foreach-object {add-member -inputobject $_ -membertype noteproperty -name mailboxdbsizeinMB -value ([math]::Round(([int64](get-wmiobject cim_datafile -computername $_.server -filter (‘name=”’ + $_.edbfilepath.pathname.replace(“\”,”\\”) + ””)).filesize / 1MB),2)) -passthru} | Sort-Object mailboxdbsizeinMB -Descending | format-table identity,mailboxdbsizeinMB{/code}
Database Whitespace
If you are using Enterprise Vault or something similar chances are you’ll have a good chunk of white space in your database which you wont need to provision for on the new environment. To identify the amount of white space in your database files use the code below, execute on the Mailbox server itself.
{code lang:css showtitle:false lines:false hidden:false}$yesterday = [DateTime]::Now.AddDays(-1)
$Events = Get-Eventlog Application | Where {($yesterday -le $_.TimeWritten)} | ?{$_.eventid -eq “1221”}
$Events | select-object Message | ft{/code}