Skip to the main content.

3 min read

Reporting on Mailbox Databases

There are a number of advantages to spreading your users’ mailboxes across your databases in Exchange 2007 versus putting department or groups in to a single database together. One of the biggest advantages is risk mitigation of a single database outage putting an entire group out of commission. Managing database sizes is also important in your environment to meet backup and restore Service Level Agreements (SLAs) in your organization.

In Exchange 2007 there is no simple way to determine the number of users per mailbox database or the size of your database files without using PowerShell (Exchange Management Shell). This article discusses a couple of ways to perform reporting on your databases. These techniques were borrowed and modified from “Nick’s Exchange and Scripting Blog“, because seriously, who creates their own scripts from scratch. Nick and I actually spent some time together in and Office Communication Server 2007 class.

Managing Number of Users Per Mailbox Database:

The first script we’re going to look at is Number of Users per Database. We take the Get-Mailbox database command to pull all Mailbox Databases in your environment. We’ve set the ResultSize to unlimited so we capture ALL mailboxes in your environment. Then we use the Group-Object command to group each mailbox by database and then select the Name and Count of each mailbox in a particular DB. Lastly we sort the output by Count.

Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count

 

Results: The result is a list of Databases with the count of Mailboxes per Database sorted by the Count. Notice that this command will pull database information from Exchange 2003 and Exchange 2007 Servers.

Name 

Count 

E2K7SRVR1SG14E2K7SRVR1-SG14-01 

10 

E2K7SRVR1SG11E2K7SRVR1-SG02-01 

25 

E2K7SRVR1SG03E2K7SRVR1-SG03-01 

25 

E2K7SRVR1SG10E2K7SRVR1-SG01-01

26 

E2K7SRVR1SG04E2K7SRVR1-SG04-01 

41 

E2K3SRVR1SG1Mailbox Store 

44 

E2K3SRVR2SG1SG1-01 

66 

E2K3SRVR2SG1SG1-02 

110 

E2K3SRVR1SG1SALES 

211 

E2K3SRVR1SG1PRODUCT 

291 

 

In a very large Exchange organization this command would not only take a long time to return a result, but there would also be a very large amount of data to analyze. We can narrow down our results with a few simple changes. Adding the –Server variable and a specific server name will help you narrow down your search.

Get-Mailbox -server:E2K7SRVR1 -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count

Results: The result is a list of Databases on E2K7SRVR1 with the count of Mailboxes per Database sorted by the Count.

Name 

Count 

E2K7SRVR1SG14E2K7SRVR1-SG14-01 

10 

E2K7SRVR1SG11E2K7SRVR1-SG02-01 

25 

E2K7SRVR1SG03E2K7SRVR1-SG03-01 

25 

E2K7SRVR1SG10E2K7SRVR1-SG01-01 

26 

E2K7SRVR1SG04E2K7SRVR1-SG04-01 

41 

 

 

Managing Size of Mailbox Databases:

The size of the EDB file is another technique for managing Exchange databases. Managing databases to a similar size will allow you to more accurately plan backup and restore times.

This method however can become quite difficult causing to move accounts on a regular basis to remain at a constant size across all databases. In any event, if you choose this method here is some code to help you identify EDB sizes.

(Assumption in this code is that you name your .EDB files the same as your databases. Ex: E2K7SRVR1-SG01-01 = E2K7SRVR1-SG01-01.EDB)

Get-MailboxDatabase | foreach { get-childitem $_.edbFilePath | select-object name,length} | sort -property length

Results: The result is a list of Databases files sizes sorted by “Length” (File size). The results of this command happen to be from a single server because our old database naming standard did not match the .EDB file name. I’ve copied the data to an excel spreadsheet for easy of formatting.

Name 

Length 

E2K7SRVR1-SG02-01.edb

465584128 

E2K7SRVR1-SG04-01.edb

618807296 

E2K7SRVR1-SG03-01.edb

681590784 

E2K7SRVR1-SG05-01.edb

1306673152 

E2K7SRVR1-SG01-01.edb

1514291200 

 

This script can be customized to just pull data from a single server by adding the –server switch to the Get-MailboxDatabase cmdlet. I’ve copied the data to an excel spreadsheet for easy of formatting.

Get-MailboxDatabase –server E2K7SRVR1 | foreach { get-childitem $_.edbFilePath | select-object name,length} | sort -property length

Name 

Length 

E2K7SRVR1-SG02-01.edb

465584128 

E2K7SRVR1-SG04-01.edb

618807296 

E2K7SRVR1-SG03-01.edb

681590784 

E2K7SRVR1-SG05-01.edb

1306673152 

E2K7SRVR1-SG01-01.edb

1514291200 

 

Sort Order:

In each example above, you can change the sort order simply by changing the value of the sort-property cmdlet. For example, in the last cmdlet by changing the sort-property from Length to Name we can sort by EDB file name.

Get-MailboxDatabase –server E2K7SRVR1 | foreach { get-childitem $_.edbFilePath | select-object name,length} | sort -property name

 

Name

Length

E2K7SRVR1-SG01-01.edb

1514291200

E2K7SRVR1-SG02-01.edb

465584128

E2K7SRVR1-SG03-01.edb

681590784

E2K7SRVR1-SG04-01.edb

618807296

E2K7SRVR1-SG05-01.edb

1306673152

 

For information on changing the scope of Exchange Management Console or Exchange Management Shell refer to the following link:

http://technet.microsoft.com/en-us/library/bb124791.aspx

Deleting the first default mailbox Database in Exchange 2010

When the first Exchange 2010 mailbox server is installed a new mailbox database is installed as well. This database is named “Mailbox Database…”...

Read More

E2010: Exchange 2010 CAS Arrays

In Exchange 2010, the Client Access Servers now handle all client traffic now (MAPI, Outlook Anywhere, IMAP, POP, OWA, etc.). In Exchange 2007, you...

Read More

Exchange Schema Versions

This is an article I first published a couple of years ago to check what schema version a customer was running when performing an Exchange upgrade....

Read More