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

What's New with Microsoft? A Deep Dive into Recent Product Updates

What's New with Microsoft? A Deep Dive into Recent Product Updates

2024 has been full of excitement already and one of the factors is that Microsoft made many major announcements! We already covered the release of ...

Copilot for Sales vs Copilot for Service – What's the Difference?

Copilot for Sales vs Copilot for Service – What's the Difference?

The Copilot products just keep coming! Microsoft Copilot for Service and Copilot for Sales became generally available through the New Commerce...

Important 2024 Microsoft Licensing Updates

Important 2024 Microsoft Licensing Updates

There is some big news in the world of Microsoft licensing this month! In the summer of 2023, Microsoft modified the licensing for Microsoft 365,...