Tuesday, March 3, 2015

Extract Average Mailbox Size for Exchange 2013 Capacity Planning

Hi folks!

Currently I'm working on the planning of the capacity for new Exchange 2013 solution, namely upgrade from Exchange 2010. To plan server and storage capacity I'm using Exchange engineer's little helper, namely Exchange 2013 Role Requirement calculator. Recently Microsoft has published version 6.6 of it for Exchange 2013 which can be found and downloaded from here.

One of the new inputs that has been introduced Initial Mailbox Size (MB). It helps you to predict how soon will you reach the mailbox maximum size that you define in the Mailbox Size Limit (MB) input.



If you are building a brand new Exchange solution you will need to place value of 0 there. This will give you the following storage usage model by mailboxes for each mailbox tier which can be located on the Mailbox Space Modeling page of the calculator. In my case I set maximum size of the mailbox to be 25 GB (25600 MB) for each profile and the whole mailbox space would be filled within 60 months or 5 years.


However things change when you are upgrading the current Exchange 2007/2010 environment, as I do. In this case you will need to populate Initial Mailbox Size (MB) with the value of the average mailbox size in your current DAG to get more accurate prediction on when mailboxes that will be migrated to Exchange 2013 will reach their maximum size.

To achieve this I used yet one more Exchange engineers later helper, namely PowerShell. Of course your scenario can be different for mine. But let's imagine the scenario when you have DAG named DAG01 and DBs within this DAG are named DAG01-DB01, DAG01-DB02 and so on. Having such a contiguous naming convention will allow you to easily retrieve mailboxes from you databases that are part of your DAG.

So in my case I first create the variable which contains all mailboxes which reside in the mailbox databases within DAG. With naming convention like mine you can easily filter databases by using part of this name which common among all the databases:

 $MBXS = Get-Mailbox -ResultSize Unlimited |where-object {$_.Database -like "*DAG01*"}

To ensure that the variable has been properly populated you may output it to the screen or CSV file using Export-Csv cmdlet.

After this we need to execute Get-MailboxStatistics cmdlet against the mailboxes populated in the variable. The attribute that is interesting to us is TotalItemSize which gives us info about the size of the mailbox. We convert this value to the numeric value and the count the average value for all mailboxes by using Measure-Object cmdlet with -Average parameter. So the code for this looks something like:

$MBXS| Get-MailboxStatistics | %{$_.TotalItemSize.Value.ToMB()} | Measure-Object -Average

This should output the average number on the screen which you can then use in your role calculator.

This works fine when command is executed in the Exchange Management Shell locally on Exchange server. However, there may be a problem when this command executed from the local workstation that is talking to Exchange server via remote PowerShell. Instead of $_.TotalItemSize.Value.ToMB() you will be getting blank values. MS has advised the following workaround in their Technet Blog article. You will have to replace TotalItemSize.Value.ToMB() with @{name="TotalItemSize (MB)"; expression={[math]::Round(($_.TotalItemSize.ToString().Split("(")[1].Split(" ")[0].Replace(",","")/1MB),2)}} 

As a result it retrieves information to the screen like below



However it won't be able to retrieve average because the numeric value is actually string against which average can't be calculated. I would get screen as below:




To overcome this I extracted output into Excel spreadsheet as below:

 $MBXS| Get-MailboxStatistics | select DisplayName,@{name="TotalItemSize (MB)"; expression={[math]::Round(($_.TotalItemSize.ToString().Split("(")[1].Split(" ")[0].Replace(",","")/1MB),2)}} |Export-Csv DAG01-SizeReport.csv

And finally in Excel all you need is to calculate average mailbox size using good old AVERAGE function which gives us a value that we can use in the calculator for the Initial Mailbox Size (MB)





As a result we are getting more accurate prediction on how soon maximum mailbox size will be reached when we migrate from the existing Exchange solution to Exchange 2013.


I hope this will help you as it did help me.

Enjoy