≡ Menu

Powershell: Create new mailbox database

After installing MS Exchange 2010 in my test lab, I want to create new mailbox database in my server. While I can do it with GUI, I am more interested in exploring the powershell way…

The exchange management shell is having very large set of cmdlets to manage exchange. In fact the GUI also is a wrapper on top of Powershell commands. So learning these commands and using them in daily operations is really useful and you can go into granular details.

New-MailboxDatabase is the cmdlet that accomplished my task here.

New-MailboxDatabase -EdbFilePath C:\Database\MailboxDB1.edb -Server TIBDC1 -Name MailDB1

Here I am creating a new mailbox database with name MailboxDB1 and placing the EDB file C:\Database folder with MailboxDB1.EDB file name. You might ask what happens to log files and where they will be saved. By default logfiles go with EDB file unless the path is specified with -LogFolderPath parameter. The -Server parameter specifies the server name where this database is going to be created.

You won’t see the creation of EDB file or logfiles in the given folder unless you mount it. So we need to use Mount-Database cmdlet to mount the newly created database. You can use the below command for that purpose.

Get-MailboxDatabase -Identity MailDB1 | Mount-Database

Hope this helps… and you will see more exchange stuff in my upcoming posts.