Showing posts with label Exchange 2010. Show all posts
Showing posts with label Exchange 2010. Show all posts

22 January 2012

Migrating to Exchange 2010

I recently performed an Exchange 2010 migration from a different domain running Exchange 2007. The whole migration worked much smoother than I expected... Here is an account of what I did.

Some user's at the client had large Exchange mailboxes with > 4 GB data. I installed a 30 day trial copy of Backup Assist (BA), my favourite SMB backup solution on the source server. Part of the BA suite is an Exchange mailbox backup. I first made sure that the program is working okay, as there are always a few hurdles to overcome with setting up the right Exchange permissions for the user account that performs the backup.

On the days before the migration I performed a "manual" mailbox backup with the destination grouping method set to "yearly backup". This option exports all the user's mailbox contents to a number of .pst files, separated into folders for each calendar year.

I then created a batch file that renamed these files, appending the year and moving them to the users's home share on the new server. The most current year (2011) I kept for migration to the new Exchange server. On the night of the server migration, I ran the standard BA mailbox backup that archived all emails to the 2012-Q1 folder and transferred this folder to the new server.

I now had to import the user's last two (2011 and 2012) .pst files into the new Exchange 2010 server. This server was installed with SP1 and patched with the latest roll-up. All user's were then setup and email flow tested. After the change-over emails were already being received by the new server. Exchange offers the new "New-MailboxImportRequest" command that make merging the contents of a .pst file into a mailbox a smooth process.

When I used the command from a PS command prompt, I encountered an issue with the permission:

The term ‘New-MailboxImportRequest’ is not recognized as the name of a cmdlet, function, script file

It turns out that by default no account has the right to run this PS cmdlet. To enable it you need to assign a new role to a specific group. I added the rights for the domain admins by using this command:

New-ManagementRoleAssignment -Name “Import Export PST” -SecurityGroup “Domain Administrators” -Role “Mailbox Import Export”

Now we were ready to begin the actual import/merge of the user's .pst files:

New-MailboxImportRequest -Mailbox -FilePath \\server\d$\Users\Mailbackup\2011\user.pst

This command was followed by a second set for all the 2012 email .pst files. I created another "batch" file, except this one was full of the above Powershell commands. Once I started this Powershell script the merge process took a good 1-2 hours. Along the way you can check progress by accessing the import queue using

Get-MailboxImportRequest

or to get more details

Get-MailboxImportRequest -Status Failed | Get-MailboxImportRequestStatistics -IncludeReport | Format-List > c:\netadmin\pstimport.txt

I encountered a few errors that were detailed by the above command. They all related to an issue with the mailbox message size:

Message (size 15.71 MB (16,474,863 bytes)) exceeds the maximum allowed size for
submission to the target mailbox. You can increase this limit by using the Set-Mailbox cmdlet in the Exchange Management Shell.
Error details: MapiExceptionMaxSubmissionExceeded: Unable to save changes. (hr=0x80004005, ec=1242)


I fixed this on the affected user's account by going to the user's mailbox properties:
  1. Go to mail flow settings, then set Message Size Restriction properties and set both Sending and Receive message size to a high value, say 50Mb.
  2. Re-run the failed "MailboxImportRequest" again, it should now be successful.
  3. Reverse the user's message size restriction back to its default value.

Sure there would have been a PS script option to perform his, but for those few users affected, the Set-Mailbox options looked to overwhelming!

Overall I have found this approach to be much easier than trying to move mailbox databases from one domain to another. The other advantage is that user's mailboxes are archived and pruned. If the user needs an old .pst file, they can attached it themselves to their Outlook.

Reference: MS Exchange .org article

28 June 2011

Exchange 2010 Mailbox Recovery

Ooh what a pain.... when you don't know how to do this. Today I learned the hard way!

Today I had to use Exchange recovery on an SBS 2011 server. It started with the client requesting that the user account be renamed from username "Fred" to a role based name "Pleb". For some starnge reason the user was no longer able to log on after I had renamed the account, so I simply deleted "Pleb" and recreated the accout from scratch. The user then demanded his email back and I thought, easy, just reconnected form the "Disconnected Mailbox" folder in the EMC. Hmm - long face, there was no such folder. It appears that if you create a new account with the same name that an existing account had, the disconnected mailbox is not reccyled or being left - no SBS deletes it. Have to try this on a real Exchange server to check the outcome. Anyway, I was facing a rstore from backup - my first foray into Exchange 2010 recovery!

This SBS server is a VM, and backups are done on the physical server using Backup Assist. When I recovered the the Hyper-V machine, I found the partition with the mailbox data file, but this is slightly different from an actual Windows application image backup on a Exchange server.

I restored the mailbox.edb file to a temp folder, but I had no log files. I fired up the exchange Management Shell (EMS) and ran
Eseutil /mh "E:\Temp\db\Mailbox Database.edb"
This command gives you some stats on the DB, the important one being the "State". in my case it was 'Dirty Shutdown', expected but not that desirable. Note to self, need to check with backup Assist support how I can get the log files. Without log files I had to perform a hard repair using:
Eseutil /p "E:\Temp\db\Mailbox Database.edb"

If we have had the log files, we could simple get the "E
Eseutil /r "E03" /l e:\temp\log /d e:\temp\db /s e:\temp\rec
I then repeated the
Eseutil /mh "E:\Temp\db\Mailbox Database.edb"
command, which brought the database back to a state of 'Clean'. The next step now was to bring this recovery database online, using:
New-MailboxDatabase RecDB -Recovery:$true -EdbFilePath "e:\temp\db\Mailbox Database.edb" -LogFolderPath "e:\temp\log" -Server Alpha
This will show the database in the EMC, but it's state is still 'unmounted'. Therefore we issue the command
Mount-Database RecDB
which mounts the database, followed by the command
Get-MailboxStatistics -Database RecDB
which lists all mailboxes in my recovery DB. My next step took some time to research as I had two options to consider: a) export the mailbox to a PST fle or b) recover the mailbox back into a users mailbox. Option a) looked quite attractive as I would not have to fiddle with the new mailbox, but it turns out that there are quite a few pre-requisites for doing this. I therefore opted for the second solution, using a command to recover the contents of the backup/recovery database into a special folder "restore" of the user's mailbox:
Restore-Mailbox -Identity "Fred" -RecoveryDatabase RecDB -RecoveryMailbox "Pleb" -TargetFolder Restore
This caused a prompt to appear, asking for confirmation to import those items into the existing mailbox. Logging on as the user, I did indeed find the new "Restore" subfolder with the desired mail items inside. Phew! What remains to do do is a bit of clean up and house keeping:
Dismount-Database RecDB
then follwoed by
Remove-Mailboxdatabase RecDB
and finally
Delete "E:\Temp\db\Mailbox Database.edb"
Happy restores!