mailbox database

All posts tagged mailbox database

First look at Exchange 2010 Beta

Exchange 2010 beta has been released for several days and of course I have installed it myself. The coming weeks  I will publish several articles about the changes in Exchange 2010 Beta. Ofcourse it is a beta so it could be that some features will not be available in the final version.

In this article I will zoom in at the mailbox part and then specificly to the Exchange Management Console.

When you open the Exchange Management Console and go to mailbox via organizational configuration you will see the following tabs:

Mailbox tabs

You can see 2 news tabs here:

  • database management
  • database availability group

First database management, on this tab your can create a mailbox and enable a database copy. The greatest difference is that there are no storage groups anymore but only databases.

When getting the properties of the database you will see 4 tabs instead of 3. I think this is done because on specific tabs more information is displayed.

Mailbox database general tab

On the general tab you will see a few new fields:

  • mounted on server: here you can see on which mailbox server the database is mounted
  • master: this is the server which is master of the specific database
  • master type: this is the type of the server which is the master of the database
  • servers that have a copy of this database: this field will contain all servers that have a copy of the database


The tab maintenance is a new tab compared with Exchange 2007. The fields displayed on this tab where previously displayed on the general tab. The only new field is circular logging, this was  displayed on Storage Group level in Exchange 2007.

On the two other tabs: Limits en Clients there has nothing been changed.

When you are searching for the option local continious replication you can spent a lot of time before finding it. LCR is not available anymore in Exchange 2010 just as almost every high availability options, these options have been replaced by a new option called:  Database Availability Group, this will be discussed later in this article.

Configuring the database copy is really easy and can be done fully via the EMC.

Mailbox database copy

Only a few fields need to be filled in:

  • the server which you would like to copy the database to, this can be only a server which is in the same DAG group as the master server.
  • replay lag time, the delay before the logs will be replayed on the other mailbox server
  • truncation lag time,  the delay before logs will be truncated on the other mailbox server
  • preferred list sequence number, the priority of the copy, this copy is used when the database needs to be activated on another mailbox server, for example when an other server needs to be activated because the master server went down.

When the datbase copy is configured you can view the status by getting the properties of the database in the lower part of the screen.

Mailbox database general tab

On the first tab you can easily see how many logs need to be copied/replayed, how many logs have been copied/replayed and what the curren priority is.When having a look at the status tab you can see several status messages of several items:

Mailbox database status tab

In Exchange 2007 this can only be done via Powershell, but now you can do it via the EMC. The button view is only active when failures happen during the copy of the database.

The second tab is called database availability group. This option makes it possible to copy a database to a maximum of 16 Exchange 2010 servers. The DAG monitor will keep an eye on database and if needed will perform an automatic database-level recovery of a database, server, or network issue. 

Before you can use the DAG functionality you will need to create a DAG group. This group contains all servers which will have a copy of the specific database

Database availability group

Configuring the DAG group goes really easy, a few fields need to be filled in:

  • database availability group name::name of the database availability group
  • file share witness share: name of the share that willbe created on the HUB server
  • file share witness directory: the name of the directory where the files need to be placed in
  • network encryption: when does traffic need to be encrypted
  • network compression: when does traffic need to be compressed

This is the end of the first article about Exchange 2010 beta.

In Exchange 2003 you could use the Cleanup database to check the mailboxdatabase for mailboxes who were not assigned to users anymore. In Exchange 2007 you can do this via the Exchange Management Shell. The command that you need to use for this is clean-mailboxdatabase. This command will scan the Active Directory for mailboxes who are not assigned to users anymore but are not marked as this in the AD. When the status is not correct it will update the status directly.

Clean-MailboxDatabase Mailbox_db

The command above will scan de mailboxdatabase Mailbox_db, the only required parameter is the databasename. There are 2 other parameters who could be usefull:

  • Confirm, this parameter will ask the user for confirmation before really executing the command.
  • DomainController, with this parameter you can specify the domaincontroller which will be used as the source for the Active Directory database.

In the previous versions of Exchange you need to do some tricks to create a resource mailbox. In Exchange 2007 it’s a default option to create one, via the both the GUI and the shell.

First we will add a box via the Exchange Management Console. This goes nearly the same as creating a user, select one other option and you have a resource mailbox.

In the first field we choose for a room or equipment mailbox in this example we choose for a room mailbox. And we will click next to continue.

In the next screen you have the ability to create a new user or assign the box to an existing user. We will create a new user.

The next step will be providing the user details, in this case we will create a user called boardroom. The password is pure formality and you don’t need it in most cases especially when you create a box which autoaccepts meetingrequests.

Click on next when ready

In the mailbox settings screen we decide on which mailbox server the mailbox will be created and in which storage group and mailbox database. The two policy options you mostly don’t user while creating a resource mailbox.

A few times clicking on next and the resource mailbox is created.

All the previous steps can be done faster with Powershell. Actually there are more option in Powershell then in the GUI. You can for example add the -room parameter to a resource mailbox of the type room to add accessoires. When choosing for a resource mailbox of the type equipment then you can use the –equipment  to do this.

New-Mailbox -UserPrincipalName boardroom2@test.local -database “First Storage Group\Mailbox Database” -Name “Boardroom 2” -OrganizationalUnit Users -DisplayName “Boardroom 2” -ResetPasswordOnNextLogon $false -Room

With the command above we will create a resource mailbox with the name boardroom2.

Let’s add some extra accessoires to it, for this we will need to do two things:

  • create the accessoire
  • add the accessoire to the resource mailbox

Creating new accessoires can only be done via Powershell:

Set-ResourceConfig -DomainController fqdn.dc  -ResourcePropertySchema Room/Networkprojector

In the exampe above we added a beamer to the list of accesoires. You can also add multiple accesoires at one time:

Set-ResourceConfig -DomainController fqdn.dc -ResourcePropertySchema (“Room/16Seats”,”Equipment/Projector”,”Room/8Seats”,”Equipment/Whiteboard”)

The next step will be to assign the accesoires to the resource mailbox. This can be done within the  Exchange Management Console. First we will need to get the properties of the resource mailbox and click on the tab Resource Information.

In the screen that opens you can click Add to add accessoires to the object:

A new windows will be opened where we can select the beamer we just created and assign it to the resource mailbox.

It would be easier if the boardroomcan autoaccept meetingrequests and look for availability of the room. In Exchange 2003 this was already possible via a few clicks, in Exchange 2007 this can easily done via the Powershell:

Set-MailboxCalenderSettings boardroom -AutomateProcessing:AutoAccept

In case you would not like to use the autoaccept functionality you need to assign delegates to the resource mailbox

Set-MailboxCalenderSettings -Indentity “boardroom” -ResourceDelegates “Pietje Puk”

In the example above we will assign Pietje Puk as a delegate of the boardroom.

As you may now you can do many things with Powershell to get things done in Exchange. Somethings can only be done via Powershell.

One of those things is creating users via a CSV file, it’s really usefull when you need to create a lot of users in one time. You can make it as nice as you want if you have the information available in the CSV file.

We could type in the command each time to read the CSV file and then create the users, but why shouldn’t we do it via a Powershell script ?

A Powershell script can be made with Notepad, the only thing you need to do is save the file with an .ps1 extension.

Below the script that we are gone use:


[string] $MailboxTemplate,

[string] $CSVFile


$Temp = ConvertTo-SecureString P@ssw0rd -asPlainText -Force

$Template = Get-Mailbox “$MailboxTemplate”

Import-CSV $CSVFile | ForEach-Object -Process {New-Mailbox -Name $_.Name -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $_.UPN -OrganizationalUnit $_.OU -Database “First Storage Group\Mailbox Database” -Password $Temp -TemplateInstance $Template}

First we arrange that we can give some parameters while executing the file, this parameters we need to execute the script, in this script we have 2 parameters:

  • $MailboxTemplate, the name of the template-mailbox (string)
  • $CSVFile, the name of the csv file (string)

All parameters should be supplied as a string format, except the password. It isn’t possible to use a password in a script without modifying it first. To prepare the password for using it in the script we need to put in the following piece in the script:

$Temp = ConvertTo-SecureString P@ssw0rd -asPlainText -Force

We will set the $Temp to be equal against the protected string that is generated from P@ssword

$Template = Get-Mailbox “$MailboxTemplate”

The next step is to arrange that $Template gets the value of the output of the command. The command will get the mailbox name containing the name that was specified with the %MailTemplate parameter. This is a mailbox that we will create before we execute the script as a template for all new mailboxes.

When all parameters are specified we can run the command. To import a CSV file we use the CSV-import  command.

Import-CSV $CSVFile | ForEach-Object -Process {New-Mailbox -Name $_.Name -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $_.UPN -OrganizationalUnit $_.OU -Database “First Storage Group\Mailbox Database” -Password $Temp -TemplateInstance $Template}

This rule can be cut in to pieces:

  • Import-CSV $CSVFile, with this piece we will arrange that the file being specified as the parameter $CSVFile will be imported.
  • ForEach-Object -Process, this command will tell the script to run every following command between the acolades will need to be run when a new line is read from the CSV fil
  • {New-Mailbox -Name $_.Name -FirstName $_.FirstName -LastName $_.LastName-UserPrincipalName $_.UPN -OrganizationalUnit $_.OU -Database “First Storage Group\Mailbox Database” -Password $Temp -TemplateInstance $Template}, in the last pieve we will replace all parameters with values from the CSV file. In this case the mailbox will be created in the First Storage Group in the Mailbox Database database

The script needs to be saved in the script directory. This directory can be found in the install directory of Exchange 2007.

Before executing the script we need to do two things:

  • create the template
  • create the CSV file

The template is really easy, it’s the same as creating a default user only we will use it as a template.

We will create the template via the Exchange Management Console, I guess you have used it a few times and start with the wizard.

We will try to complete all fields, choose a name that you can easily recognize, for example _template

When finished click next next

In the screen above it’s important to choose the correct Mailbox Server, this will be used for all users who are created via this template. The Storage Groupwill be hardcoded in the script.

When the user is created you can get the properties of the user and go to the tabs Address and Phone and Organization and fill in the fields that are generic for each user. This is optional and you can choose to do this also via the script, for this you need to add some extra fields to the csv and extra code to the script to import these fields.

Some values will be automaticly assigned to new users: City and Country/Region, this will ensure that it doesn’t cost you a lot of time to fill it in manually.  Some values are not being parsed, fields such as Zip-Code and Street Address are examples of this.

If you want to create users in different departments, it may be easier to create multiple templates. This because I haven’t found out how you can specify using the new-mailbox command.

Now that we have created the template mailbox we only need to create the CSV file, this can be done via Notepad or Excel. I created a CSV myself in Notepad.

Now that we have done all preparations it’s just a matter of running the script. You need to execute the script via the Exchange Management Shell:

CreateNewUser.ps1 -MailboxTemplate “_Template_Rotterdam” -CSVFile “c:\users.csv”

When the script is completed you will have the following result:

After a refresh, when the Exchange Management Consoleopen is left open, you can see the users there too.

As promissed a lthe extra piece of script that will arrange that the fiels from the Address and Phone en Organization tab will be used:

|Set-User -Department $_.Department -Office $_.Office -Phone $_.Telephone -StreetAddress $_.Street -City $ -PostalCode $_.PostalCode -CountryOrRegion $_.CountryOrRegion

The piece between the accolades now looks like this:

{New-Mailbox -Name $_.Name -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $_.UPN -OrganizationalUnit $_.OU -Database “First Storage Group\Mailbox Database” -Password $Temp -TemplateInstance $Template |Set-User -Department $_.Department -Office $_.Office -Phone $_.Telephone -StreetAddress $_.Street -City $ -PostalCode $_.PostalCode -CountryOrRegion $_.CountryOrRegion}

The CSV file needs to be extended with the values of the fields:


A user will now look like this:

Pietje Puk,Pietje,Puk,Pietje.Puk@test.local,test.local/Rotterdam,IT,Rotterdam,010-1234567,Coolsingel 111,2332 ZZ,Rotterdam

Executing the script goes the same:

CreateNewUser.ps1 -MailboxTemplate “_Template_Rotterdam” -CSVFile “c:\users.csv”

In the Exchange Management Shell you don’t really get a good output, therefor we need to look in the  Exchange Management Console:

This is the end of this tutorial, it’s quite a long one I think, but it’s very useful when you need to create multiple users in Exchange 2007.