When planning a mailbox migration to Exchange Server 2007 you should consider the amount of transaction logging that will be generated by the move. In low risk environments circular logging can be used to avoid disk space problems caused by the volume of transaction logs generated during bulk mailbox moves.
You can query the current state of circular logging on your storage groups with the Get-StorageGroup cmdlet.
[PS] C:\>Get-StorageGroup | fl name, circularloggingenabled
Name : SG1 Staff A-L
CircularLoggingEnabled : False
Name : SG2 Staff M-Z
CircularLoggingEnabled : False
Name : SG4 Public Folders
CircularLoggingEnabled : False
Name : SG3 Service Accounts
CircularLoggingEnabled : False
To enable circular logging use the Set-StorageGroup cmdlet. You can enable circular logging on all storage groups together by piping a Get-StorageGroup command to Set-StorageGroup.
Get-StorageGroup | Set-StorageGroup -CircularLoggingEnabled $true
Get-StorageGroup will now reflect the change.
[PS] C:\>Get-StorageGroup | fl name, circularloggingenabled
Name : SG1 Staff A-L
CircularLoggingEnabled : True
Name : SG2 Staff M-Z
CircularLoggingEnabled : True
Name : SG4 Public Folders
CircularLoggingEnabled : True
Name : SG3 Service Accounts
CircularLoggingEnabled : True
Use Set-StorageGroup again to disable circular logging after your migration is complete.
Get-StorageGroup | Set-StorageGroup -CircularLoggingEnabled $false
When deploying customer systems I almost never use the default “First Storage Group” and the associated mailbox database, or at the very least will move and rename them to suit the situation. In a lot of cases more than one storage group and mailbox database is required for the customer. Creating these through the Exchange Management Console is a bit of a drag, and so is doing them one by one in the Exchange Management Shell.
Since you’ve pre-planned your Exchange system before installing it (right?) you can also take the time to whip up a script that will create your storage groups and mailbox databases for you while you do something more enjoyable. The script will make use of the New-StorageGroup, New-MailboxDatabase, and optionally the Mount-Database cmdlets.
I’ve uploaded a sample script here:
PowerShell Script
How to run the script:
- Download the script file from the link above and save it to your computer
- Rename the file extension to .ps1
- Launch the Exchange Management Shell
- Execute the script by entering the name of the file (eg C:\Script\createmailstores.ps1)
The script will output the name of each Storage Group as it is created, and then the name and all of the details of each of the Mailbox Databases as they are created. A 300 second (5 minute) sleep is inserted at the end to try to avoid errors that can appear if you try to mount a database too soon after it has been created.
If any of the databases fail to mount you can wait a few more minutes before trying again. One way of mounting several dismounted databases all together is to pipe the Get-MailboxDatabase cmdlet into the Mount-Database cmdlet like so:
Get-MailboxDatabase | Mount-Database
Because all of the databases are created with the MountAtStartup attribute set to True you can also mount all of the databases by restarting the Microsoft Exchange Information Store service like so:
[PS] C:\>Restart-Service MSExchangeIS
WARNING: Waiting for service 'Microsoft Exchange Information Store
(MSExchangeIS)' to finish stopping...
WARNING: Waiting for service 'Microsoft Exchange Information Store
(MSExchangeIS)' to finish starting...
You should not use the Restart-Service method if you already have production databases running on the server.
Thanks to the Exchange Management Shell you can check the status of your Exchange Server 2007 services with a single command line.
[PS] C:\>Get-Service | Where {$_.Name -match "Exchange"}
Status DisplayName
------ -----------
Running Microsoft Exchange Active Directory...
Running Microsoft Exchange Anti-spam Update
Running Microsoft Exchange EdgeSync
Running Microsoft Exchange File Distribution
Stopped Microsoft Exchange IMAP4
Running Microsoft Exchange Information Store
Running Microsoft Exchange Mailbox Assistants
Running Microsoft Exchange Mail Submission
Stopped Microsoft Exchange Monitoring
Stopped Microsoft Exchange POP3
Running Microsoft Exchange Replication Service
Running Microsoft Exchange System Attendant
Running Microsoft Exchange Search Indexer
Running Microsoft Exchange Service Host
Running Microsoft Exchange Transport
Running Microsoft Exchange Transport Log Se...
Running Microsoft Search (Exchange)
Exchange Server 2007 permits you to install the product and use it for 120 days in trial mode without entering a product key. If you intend to use your system in production you should enter your Exchange Server 2007 product key within that 120 day period (preferably before your system goes into production).
You can check the status of your servers using the Exchange Management Console.
[PS] C:\>Get-ExchangeServer | fl name,productkey,*trial*
Name : MAILSRV
IsExchange2007TrialEdition : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod : 00:00:00
Name : MAILSRV1
IsExchange2007TrialEdition : True
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod : 119.06:14:51.6643750
To add your product key to a server use the Set-ExchangeServer cmdlet.
[PS] C:\>Set-ExchangeServer -Identity MAILSRV1
-ProductKey 12345-ABCDE-12345-ABCDE-12345
WARNING: The product key has been validated and the
product ID has been successfully created.
Note: This change will not be complete until the
Microsoft Exchange Information Store service has
been restarted.
[PS] C:\>restart-service MSExchangeIS
WARNING: Waiting for service 'Microsoft Exchange
Information Store (MSExchangeIS)' to finish
stopping...
You can now use Get-ExchangeServer to verify the server is correctly licensed.
[PS] C:\>Get-ExchangeServer | fl name,productkey,*trial*
Name : MAILSRV
IsExchange2007TrialEdition : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod : 00:00:00
Name : MAILSRV1
IsExchange2007TrialEdition : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod : 00:00:00