Exchange 2010 database recovery

This article outline’s the steps to restore an exchange database in Exchange 2010, christened Recovery Database for DAG.
1. Create 2 folders:

•Database –> D:\Recovery\Database
•Transaction Logs –> D:\Recovery\Logs
2. Now restore the database which is to be recovered and the subsequent logs exactly to the above location

3. Now follow steps 1-7 mentioned in the article and make the database in a clean shutdown :

Exchange Database Recovery – Using eseutil commands: http://msexchangeguru.com/2009/07/12/exchange-database-recovery-using-eseutil-commands/

4. Once the database is in clean shutdown state, rename the original database file to “RecoverDB.edb”.

NOTE: Don’t copy the logs since ESEUTIL /R replayed them into the EDB and the database does not require any more logs to make it clean shutdown.

5. Use the Exchange management Shell to create a recovery database.

This example creates the Recovery Store “RecoverDB” on the server MSXEXCH using the defined path for the database file and transaction logs folder.

New-MailboxDatabase -Recovery -Name RecoverDB -Server MSXExch -EDBFilePath D:\Recovery\Database\RecoverDB.edb -LogFolderPath D:\Recovery\Logs

Important: If you have EMC Console open, you will need to restart it to see the newly created Recovery mailbox Store “RecoverDB“ under the Organization Configuration–> Mailbox –>Database Management and its state will be dismounted.

6. Now Right click on the newly created recovery Store and mount it.

7. Now open Shell and type the command as shown:

Get-MailboxStatistics -Database RecoverDB

This will show the list of mailboxes in that database.

8. This is the cmdlet to recover entire mailbox content for the mailbox UserA

Restore-Mailbox -Identity UserA -RecoveryDatabase RecoverDB

This will take time depending on the size of the mailbox.

9. This is the cmdlet to restore UserB mailbox content into UserA mailbox under the RecoverTest folder.

Restore-Mailbox –Identity UserA –RecoveryDatabase RecoverDB –RecoveryMailbox UserB –TargetFolder RecoverTest

10. This is the cmdlet to restore all mailboxes in the database mbx1 which are also present in the RecoverDB database. For every mailbox it will ask you to confirm the action, we do have an option “Yes to All”

Get-Mailbox –Database mbx1 Restore-Mailbox –RecoveryDatabase RecoverDB

Exchange 2007 ActiveSync reporting

Increase in the number of mobile users using Exchange ActiveSync has grown rapidly over the years. iPhone and Windows mobile capturing market nowadays, its extremely important for exchange admins to monitor and report their usage real-time.
There have been instances where Exchange design solutions where implemented not knowing the exact impact of OWA and ActiveSync users and the load balancing CAS servers went unresponsive.

This article stresses on the importance and processes for a term well used in Exchange 2007 – Exchange ActiveSync reporting.

The best part is, we don’t have to install any tools or additional software’s for this, the Exchange 2007 power shell does the trick.

I am going to explain two cmd-lets in this article, one for all IIS logs in the W3SVC folder and one for a Single IIS log file. The process of extracting Exchange ActiveSync users with mobile devices is known as PARSING and this process was rather a hectic one in Exchange 2003.

Create a folder: C:\ActiveSync_reporting. Keep in mind that the IIS logs in a windows 2008 machine is stored in “C:\inetpub\logs\LogFiles”.

This is for all files in the logs folder:

Get-Childitem “C:\inetpub\logs\LogFiles\W3SVC1″ where-object {$_.lastwritetime -gt $DateToCompare} ForEach { Export-ActiveSyncLog -FileName $_.FullName -OutputPath “C:\ActiveSync_reporting” -OutputPrefix $_.Name.Replace(“.log”,”_”) -UseGMT:$true}

Output will be 6 files as shown:

Length Name
—————————
u_ex100411_Users.csv
u_ex100411_Servers.csv
u_ex100411 _Hourly.csv
u_ex100411_StatusCodes.csv
u_ex100411_PolicyCompliance.csv
u_ex100411_UserAgents.csv

u_ex100412_Users.csv
u_ex100412_Servers.csv
u_ex100412_Hourly.csv
u_ex100412_StatusCodes.csv
u_ex100412_PolicyCompliance.csv
u_ex100412_UserAgents.csv

If we need output for just a single IIS log:

Export-ActiveSyncLog -FileName “C:\inetpub\logs\LogFiles\W3SVC1\u_ex100410.log” -UseGMT:$true -OutputPath “C:\ActiveSync_reporting

Length Name
———————–
u_ex100410_Users.csv
u_ex100410_Servers.csv
u_ex100410_Hourly.csv
u_ex100410_StatusCodes.csv
u_ex100410_PolicyCompliance.csv
u_ex100410_UserAgents.csv

The most important file in the output is Users.csv which shows:

1. Username
2. Device ID
3. Device type
4. Hits on the CAS server

With the StatusCodes.csv, we can create a report based on http code status and find device-server communication health:

200 – Authentication pass
400 – Bad/invalid request
401 and 403 – Unauthorized/server refusing request
404 – File not found
449 – Retry
500 – Server error
503 – Service unavailable