Recover an individual folder from a users mailbox from a Data Protection Manager (DPM) Backup to Exchange 2010

A user came to me the other day. To folders were missing from their inbox and they asked if it would be possible to recover them.
Recently I hade implemented a backup procedure using DPM but, I had no idea how to restore from it.
Here is what I learned:

  1. The first thing that you have to do is create a Recovery Database RDB. This is not like a normal Database as it does not interact with any other Database and no protocols can communicate with it. You have to create this DB with the following PowerShell command line:

    New-MailboxDatabase -Recovery -Name RDB -Server “servername” -EdbFilePath “path” -LogFolderPath “path”
    Pasted from <http://www.symantec.com/connect/articles/how-restore-exchange-2010-database-recovery-database-using-backup-exec-2010>

    Once you have done this, you have to specify that a backup restore job can overwrite this DB:
    Go to the Database properties -> Maintenance and tick the box that says “This Database can be overwritten by a restore”

  2. Next, you need to perform the restore from DPM.
    1. Click the recovery tab, find the DB with the users, choose the date and click recover:


    2. You will then be asked to specify the Exchange server and the name on the recovery DB
  3. Now you have recovered the Database but, it is in a DB that can not communicate with any others. You need to create a recovery users and then use PowerShell to transfer the data. The recover users in just a standard user account.
  4. Once you have created the user run the following command line:

    Restore-Mailbox -Identity Scott -RecoveryDatabase MyRecoveryDatabase -RecoveryMailbox John -TargetFolder Recovery

  5. You Can then give yourself permission to the users mailbox. (right click user, “Manage Full Mailbox permissions”). Do the same for the recover user. You will then see the mailboxes in your Outlook (This can take 5 minutes). You can then drag and drop folders as you wish.

Create contacts using powershell

oday I had a colleague come to me, asking for help as she had a user asking to have 649 mail contacts created and added to a distribution group by the end of the day.

Now instead of sitting there and slowly adding in each and every single contact individually (which if you’ve had to do this before in Exchange you’ll know it’s an absolute nightmare!!) I decided to modify a script I wrote a while back for importing mailboxes from a CSV file.

So the format of the CSV file should be:

Name Email OUPAth
Test User test.user@domain.com domain.local/Mail Contacts/Test

For the OUPath you can easily find this out by going into your Active Directory and right clicking on the folder you wish the mail contacts to be imported into, and going to Properties

OU Properties

OU Properties

As you can see in the Object section you can find out the OU Path, by looking at the Canonical name of object:

Once the .CSV file is created and formatted correctly you can use this wonderful little powershell script I wrote:

Import-CSV C:\createnewcontact.csv | ForEach-Object{
New-MailContact -ExternalEmailAddress $_.Email -Name $_.Name -OrganizationalUnit $_.OUpath
}

Now I’ll talk you through section by section on what this script does so you’re a little more aware (and i can prove I didn’t just copy and paste from a website :p)

Now “Import-CSV C:\createnewcontact.csv” basically tells Powershell to import data from the CSV file which lives directly on the C:\ and is called createnewcontact.csv (bare in mind if you call your CSV differently you will need to change this section)

“ForEach-Object{” allows you to perform an action on each item in the collection (in this case everything between the { }

“New-MailContact“This is kind of self-explanatory be be honest. If you want a new mailbox you put New-mailbox and for a new mail contact you use New-MailContact

Now when you run New-MailContact manually into PowerShell it asks you for 2 pieces of information:

  • ExternalEmailAddress
  • Name

So when your PowerShell script runs New-MailContact it still needs this information. So by using “-ExternalEmailAddress$_.Email” you are telling the script that when it gets asks what the -ExternalEmailAddressis the PowerShell sees $_.Email which signifies to it that it should get this information from the Email column ($_. tells it to use a column and the name after it is the column name)

This is the same for -Name $_.Name -OrganizationalUnit $_.OUpath

I’m not the greatest at explaining things so I do apologise. If in doubt just copy exactly what I’ve done and you’ll be fine :)

Mailcontact Powershell

Mailcontact Powershell

Pop in the location of the script into Power Shell (or if you’re really lazy just drag and drop the script from Explorer into the Power Shell window) and hit enter and watch it run away and create hundreds of mail contacts from your .CSV file in seconds…and then have a beer