I was setting up a new Exchange Server 2007 cluster today and decided to share this technique I use to save time configuring the mailbox databases.
Since the clusters we build tend to have a lot of storage groups and databases on them (25 for the one I worked on today) some automation really speeds things up.
Firstly I always use a script to create the storage groups and mailbox databases. This is pretty easy, especially when you have naming standards that let you do a find/replace on the script as you use it from server to server.
The cmdlets for these operations are New-StorageGroup and New-MailboxDatabase. You’ll find a very old sample script of mine here that demonstrates how they can be scripted.
Secondly I use a few shell commands to clone the database configuration from an existing mailbox database. By that I mean settings such as the mailbox retention, deleted items retention, storage quotas, offline address book, and public folders. These are settings that we typically keep the same across all the Exchange clusters.
First I collect the settings from an existing mailbox database into an array.
$a = Get-MailboxDatabase [name of database to clone]
The various settings can then be referenced in the array, such as $a.PublicFolderDatabase.
Once I’ve done that there are two ways to apply it to other mailbox databases. I can apply it to a single database like this.
Set-MailboxDatabase [new mailbox database name] -OfflineAddressBook $a.OfflineAddressBook -PublicFolderDatabase $a.PublicFolderDatabase -IssueWarningQuota $a.IssueWarningQuota -ProhibitSendQuota $a.ProhibitSendQuota -ProhibitSendReceiveQuota $a.ProhibitSendReceiveQuota -MailboxRetention $a.MailboxRetention -DeletedItemRetention $a.DeletedItemRetention
Or, as I did today, I can apply it to all of the mailbox databases on a given server.
Get-MailboxDatabase -server [new server name] | Set-MailboxDatabase -OfflineAddressBook $a.OfflineAddressBook -PublicFolderDatabase $a.PublicFolderDatabase -IssueWarningQuota $a.IssueWarningQuota -ProhibitSendQuota $a.ProhibitSendQuota -ProhibitSendReceiveQuota $a.ProhibitSendReceiveQuota -MailboxRetention $a.MailboxRetention -DeletedItemRetention $a.DeletedItemRetention
As you can see the Exchange Management Shell really does make it easy to administer Exchange 2007 and 2010 environments.