Restoring Exchange Online mailbox content to another mailbox using PowerShell command New-MailboxRestoreRequest | Part 22#23 5/5 (1) 19 min read

The current article we review the second solution that we can use for – dealing with a common Exchange Online mailbox restore mistake that occurs in Office 365 Directory synchronization environment or Exchange Hybrid environment.

Restore Exchange mailbox | Article Series table of content | Click to expand

Restore Exchange Online deleted mailbox | Article Series

Exchange Online mailbox restore | Articles series table of content
Introduction to the subject of Exchange and deleted mailboxes
01 Restore deleted Exchange Online mailbox in Office 365 environment | Prefix | Part 01#23
02 Directory Object Deletion and the restore “domino effect + little bit about the concept of the Active Directory Recycle bin | Part 2#23
03 What are the possible causes for an Exchange Online mailbox deletion? | Part 3#23
04 What are the possible options for recovering Exchange Online mailbox? | Part 4#23
05 The Index of the different Exchange Online mailbox restores methods| Part 5#23
Restoring Exchange Online mailbox – cloud only environment
06 Restore Exchange Online Room mailbox | Cloud only (Fully Hosted) environment | Part 6#23
07 Restore Exchange Online Shared mailbox | Cloud only (Fully Hosted) environment | Part 7#23
08 Restore Exchange Online user mailbox | Cloud only (Fully Hosted) environment | Article 1#3 | Part 8#23
09 Restore Exchange Online user mailbox | Cloud only (Fully Hosted) environment | Article 2#3 | Part 9#23
10 Restore Exchange Online user mailbox | Cloud only (Fully Hosted) environment | Article 3#3 | Part 10#23
Restoring Exchange Online mailbox in Directory synchronization environment
11 The special characters of Directory synchronization in an Office 365 environment | Article 1#2 | Part 11#23
12 The special characters of Directory synchronization in an Office 365 environment | Article 2#2 | Part 12#23
Restoring user account – On-Premise Active Directory environment
13 Deleted Active Directory User account and the Deleted object store | Basic introduction | Article 1#4 | Part 13#23
14 How to restore Active Directory deleted user account (Active Directory recycle bin is not enabled) using LDP.EXE | Article 2#4 | Part 14#23
15 How to restore Active Directory deleted user account (Active Directory recycle bin is not enabled) using AdRestore, AdRestore.net and LEX – the LDAP explorer | Article 3#4 | Part 15#23
16 How to restore Active Directory deleted user account by using Active Directory recycle bin | Article 4#4 | Part 16#23
Restoring Exchange Online mailbox in Directory synchronization environment
17 Restore Exchange Online USER mailbox | Directory synchronization environment | The “right way” | Part 17#23
18 Prefix – the “Problematic” Exchange Online mailbox restores scenarios in Directory synchronization environment | Part 18#23
19 Reviewing the characters of Exchange Online mailbox recovery mistake – New On-Premise Active Directory User Account was created | Part 19#23
20 Reviewing the characters of Exchange Online mailbox recovery mistake – Soft Deleted Office 365 was restored | Part 20#23
21 Solving an Exchange Online mailbox restore mistake by Restoring the original Soft Deleted Active Directory user | Part 21#23
22 Restoring Exchange Online mailbox content to another mailbox using PowerShell command New-MailboxRestoreRequest | Part 22#23
23 Solving an Exchange Online mailbox restore mistake Office 365 user was restored – removing the ImmutableID value | Part 23#23

In our scenario Exchange, Online mailbox deleted because of the event in which an On-Premise Active Directory user account deleted.

  • The On-Premise Active Directory user “bound” to his Office 365 user account “replica.”
  • The Office 365 user account had Exchange Online license and Exchange Online mailbox assigned to him.

The common restores mistake is that – instead of restoring the original On-Premise Active Directory user account that deleted, a NEW On-Premise Active Directory user account with seemingly identical details as the deleted user account created, and the information is synchronized to the Office 365 Directory.

The proposed solution is – recovering the content of the Soft Deleted Exchange Online mailbox to the NEW Exchange Online mailbox that created.

This process implemented by using a very useful PowerShell command named –
New-MailboxRestoreRequest, that designed to “Transport” data (mailbox mail items) from a specific Exchange Online mailbox to another Exchange Online mailbox.

Note – in the former article, we review another type of solution that can be used for dealing with the Exchange Online mailbox restore mistake in which a NEW Active Directory user created.

The characters of Exchange Online restore mistake – creating a NEW Active Directory user account – Scenario description

To be able to understand better,

  1. What are the characters of the “Wrong Exchange Online Mailbox Recovery Operation” in which a NEW Active Directory user account created?
  2. What are the results of this “Wrong Exchange Online Mailbox Recovery Operation?”
  3. What is the offered solution that we will implement in dealing with the “Wrong Exchange Online Mailbox Recovery Operation?”

Let’s use the following scenario:

Organization mail infrastructure

  • An organization uses Office 365 services, and Exchange Online as his mail infrastructure.

Directory infrastructure

  • Directory management is implemented via the On-Premise Active Directory, and Directory synchronization server (Azure AD Connect).
  • The Directory synchronization server is responsible for synchronizing information from the local On-Premise Active Directory to the Office 365 Directory (Azure Active Directory).

The deletion event

  1. On-Premise Active Directory user account named James deleted (number 1).
  2. The information about the “On-Premise Active Directory user deletion,” synchronized by the Directory synchronization server (Azure AD Connect) to the Office 365 Directory (Azure Active Directory) (number 2).
  3. The result is that the James Office 365 user account that “bound” to the James deleted On-Premise Active Directory user account,” also deleted (number 3).
  4. When James Office 365 user account deleted, the Exchange Online license that assigned to James Office 365 user account, removed (deleted) (number 3).
  5. Azure Active Directory synchronizes the information to the Exchange Online infrastructure.
  6. When Exchange Online gets the information about the fact that the James Exchange Online license removed, Exchange Online deletes the James Exchange Online mailbox (number 4).

Active Directory user deletion -flow of the events in Directory synchronization-01

The restore request

The Administrator, got a request to – recover James Exchange Online deleted mailbox, and enable James to access his restored Exchange Online mailbox.

The “right” process of recovering Exchange Online in Directory synchronization environment

The “right” restore process supposed to start with – recovering James Soft Deleted On-Premise Active Directory user account, and the rest of the Exchange Online mailbox recovery steps were supposed to “roll along” automatically.

Note – you can read more information about the “right procedure” of recovering Exchange Online in Directory synchronization environment in the article –
The special characters of Directory synchronization in an Office 365 environment | Article 2#2 | Part 12#23

The main characters of the Exchange Online restore mailbox mistake

The Exchange Online mailbox recovery mistake

The Administrator who responsible for performing the task of – restoring James Exchange Online mailbox restore, thought that the solution would implement in the following way:

  • Creating a NEW On-Premise Active Directory user account, with seemingly identical details as the “deleted James’s user account” (the same login name and the same E-mail address).
  • Activating the Directory synchronization process, and synchronize the information about the “recovered” James On-Premise Active Directory user account to – Office 365 Directory (Azure Active Directory).

The Problem -New On-Premise Active Directory User was created -02

The Administrator underlying assumption was, that when the Directory synchronization process runs, the mechanism of Soft Match will be automatically executed.

The Directory Synchronization Soft Match mechanism which supposed to “bind together” the NEW James On-Premise Active Directory user account, with the Azure Active Directory – Soft Deleted James’s user account, because they have the same user login name and the same E-mail address).

The “binding process” will lead to:

  • The automatic restore process of the Office 365 Soft Deleted James’s user account.
  • The automatic process of restoring the Exchange Online license that assigned to the Office 365 user account.
  • The automatic restore process of – James Soft Deleted Exchange Online mailbox.

When the Administrator Login to the Office 365 management portal, he sees that the James Office 365 user account “restored” (the Office 365 user account seemingly restored, the truth is that the Office 365 account that the Administrator sees is a NEW Office 365 user account), and notice that “for some reason,” the Exchange Online license that assigned to James Office 365 user account, was not restored.

To fix this “license issue,” the Administrator assigns the required Exchange Online license to James Office 365 user accounts.

Note that the real reason that the Office 365 license not being assigned is, that in this scenario, the original Office 365 not restored, and instead, a NEW Office 365 user account created! (Exchange Online license in not assigned automatically to NEW Office 365 users).

The result

The Directory Synchronization Soft match did not occur.

The process of the Directory Synchronization Soft match will not occur!

The Directory synchronization will not “bind” the NEW James Active Directory user to the Soft Deleted James Office 365 user account because the Soft Deleted Office 365 user account ImmutableID value already populated with some value (the value of the original James deleted Active Directory user).

The NEW James Active Directory user account has a NEW GUID (Globally Unique Identifier) value that is different from the Soft Deleted Office 365 user account ImmutableID value.

For this reason, Directory synchronization, cannot execute the expected “binding” (Soft Match) between the two user accounts and instead, create NEW Office 365 user account, that will be “bind” to the – NEW On-Premise Active Directory James user account.

Two “sets” of user account and Exchange Online mailboxes

The outcome is a “mess.”

Instead of the expected result, the “real result” is that now, we will have “two sets” of user accounts and two sets of Exchange Online mailboxes.

The outcome- New On-Premise Active Directory User was created -03

Set A – The NEW objects

  • The creation of a NEW On-Premise Active Directory user account, will lead to a scenario, in which a NEW Office 365 user account will be created.
  • When Exchange Online license is assigned to the NEW Office 365 user account, a NEW empty Exchange Online mailbox will be created.

The result is:

  • A NEW Active Directory user account.
  • A NEW Office 365 user account.
  • A NEW Exchange Online mailbox.

Set B – The “former” Soft Deleted objects

The addition “layer” of objects, is the layer of the Soft Deleted objects, that will continue to exist in the various recycle bins:

  • The original James Soft Deleted Active Directory user will continue to be stored in the Active Directory recycle bin.
  • The Soft Deleted James Office 365 user account that “bound” to the Active Directory user, will continue to be stored in the Azure Active Directory recycle bin.
  • Soft Deleted James Exchange Online mailbox will continue to be stored in the Exchange Online recycle bin.
Note – in an Office 365 based environment, the Soft Deleted user account, and the Soft Deleted Exchange Online mailbox will be kept in the Office 365 recycle bin for a period of 30 days.
At the end of this period, the Soft Deleted object will be will be permanently deleted.

New On-Premise Active Directory User Account was created and synchronized to the cloud -04

The outcome

The NEW James On-Premise Active Directory user can access his Exchange Online mailbox, but he reports that the Exchange Online mailbox restore failed because the mailbox is empty!

Notice that the Exchange Online mailbox data that supposed to “appear,” is stored in the Soft Deleted Exchange Online mailbox (that is in the Exchange Online recycle bin).

The Problem -New On-Premise Active Directory User was created -01

Description of the proposed solution – importing the content of the Soft Deleted mailbox to – the NEW empty mailbox using the PowerShell command New-MailboxRestoreRequest.

The Solution

The offered solution is implemented by importing the content of the James Soft Deleted mailbox to – James NEW empty Exchange mailbox, using the PowerShell command
New-MailboxRestoreRequest.

Copy the content of the Soft Deleted Exchange Online mailbox -New-MailboxRestoreRequest-02

The PowerShell command – New-MailboxRestoreRequest, created for enabling Exchange Online Administrator, to “Ship” mailbox content from a “source Exchange Online mailbox” to a “destination Exchange Online mailbox.”

In this type of solution, we don’t try to “revert” the Exchange Online restores mistake, but instead, we will use the existing NEW set of users (On-Premise Active Directory and Office 365), and the NEW Exchange Online mailbox that created.

Copy and Paste Exchange Online mailbox content-03

In our scenario, we have two Exchange Online mailboxes: the original Exchange Online mailbox that considers as Soft Deleted mailbox and the NEW empty Exchange Online mailbox that created.

In the following diagram, we can see the description of all the components that involved throughout the process.

Import the content- Soft Deleted Exchange mailbox -Empty Exchange mailbox-04

General Note
Another possible solution that can be implemented (“Revert the restore mistake.”) described in the article- Solving an Exchange Online mailbox restore mistake by Restoring the original Soft Deleted Active Directory user | Part 21#23The other solution - Revert the restore mistake-05

The Challenge
To be able to “copy and paste” the mailbox content, we will need to address the required Exchange Online mailboxes. Most of the time, we address Exchange Online mailbox by using standard identifiers such as – the mailbox Alias or the mailbox E-mail address.

In our scenario, we will not be able to reference the “source Exchange Online mailbox” or the “detonation Exchange Online” by using a standard “identifier” such as the Alias name. The reason is that because, the Soft Deleted Exchange Online mailbox and the NEW empty Exchange Online mailbox that created, have the same Alias name and the same E-mail address.

To be able to bypass this obstacle, and to address the required Exchange Online mailboxes, we will use the GUID value as an identifier (the GUID value is a unique identifier).

  1. In step one, we will use a PowerShell command that will “reveal” the GUID value of each of the involved Exchange Online mailboxes.
  2. In the next phase, we will address the Exchange Online mailbox by using the GUID value as the “identity value.”

How to use the right identity unique identity of each of the mailboxes-06

Implementing the solution of – importing the content of the Soft Deleted mailbox to – the NEW empty mailbox using the PowerShell command New-MailboxRestoreRequest.

In the following sections, we will demonstrate a scenario that includes the following parts:

  • Step 1#3 – Simulating the event in which On-Premise Active Directory user account is deleted.
  • Step 2#3 – Simulating the Exchange Online mailbox restore mistake.
  • Step 3#3 – Fixing the Exchange Online mailbox restore mistake – importing Soft Deleted mailbox content to the NEW empty mailbox using New-MailboxRestoreRequest

Before we start, let’s look at the James Exchange Online mailbox.

We can see that James got an E-mail message from Brad and that the E-mail message subject is – “This is an E-mail message from Brad before the mailbox deleted.”

In the last step in which we “merge” the data from the Exchange Online Soft Deleted to the NEW Exchange Online mailbox; I will show you how the “old content” merged with the NEW Exchange Online mailbox content (in the next section 2#3, the James Exchange Online mailbox will be deleted).

Original user mailbox content before the deletion -01

Step 1#3 – Simulating the event in which On-Premise Active Directory user account is deleted.

In our example, we will simulate the scenario, by deleting the James On-Premise Active Directory user account.

Simulating the event in which the original Active Directory user account is deleted -01

  • The information about the “On-Premise Active Directory user deletion,” synchronized by the Directory synchronization server (Azure AD Connect) to the Office 365 Directory (Azure Active Directory).
  • The result is, that the James Office 365 user account that was “bound” to the deleted On-Premise Active Directory user account” is also deleted.
  • When the Office 365 user account was deleted, the Exchange Online license that was assigned to James Office 365 user account, was removed (deleted).

Office 365 | Exchange Online infrastructure | Exchange Online Admin Center

  • Azure Active Directory synchronizes the information to the Exchange Online infrastructure.
  • When Exchange Online gets the information about the fact that the Exchange Online license was removed, James Exchange Online mailbox that was associated with Office 365 user account deleted.

To be able to view the Soft Deleted James Exchange Online mailbox, we will use Exchange Online admin center.

Exchange Online, provides a graphic interface for viewing the content of the Exchange Online recycle bin – recipient => mailboxes => three dots => Deleted mailboxes.

View the Soft Deleted Exchange Online mailbox -01

In the following screenshot, we can see the content of the Exchange Online recycle bin.
We can see that the Exchange Online recycle bin includes James Soft Deleted mailbox.

View the Soft Deleted Exchange Online mailbox -02

Step 2#3 – Simulating the Exchange Online mailbox restore mistake

In this section, we will simulate the Exchange Online “recovery mistakes,” in which a NEW Active Directory user account was created.

The “right restore action” was supposed to be – restoring the On-Premise Active Directory Soft Deleted Jame’s user account.

Note – you can read more information about the “right procedure” of recovering Exchange Online mailbox in Directory synchronization environment in the article – Restore Exchange Online USER mailbox | Directory synchronization environment | The “right way” | Part 17#23

On-Premise | Active Directory

The Administrator, create a NEW On-Premise Active Directory user account for James, that is seemingly identical to the James user account that was deleted.

The NEW James On-Premise Active Directory user account configured with the same login name and the same E-mail as the “former James user account” (the Soft Deleted Active Directory user account).

Simulating the event in which a NEW Active Directory user account is created -01

In our example, I use the user account description field, to emphasize the fact that the particular user account is a NEW account.

Simulating the event in which a NEW Active Directory user account is created -02

Office 365 | Azure Active Directory | Office 365 Admin center interface

In this step, we want to view the information about the “Office 365 user account” that was supposed to be “restored,” after the Directory synchronization process completed.

When looking at the active user list in the Office 365 admin center portal, we can see that a James Office 365 user account “appears.”

Note – notice that this is not the restored James user account, but instead, a NEW Office 365 user account that was created!

When we look at the James Office 365 account properties, we can notice two important parameters:

  • In the Sync Type column, we can see that the user account defined as “Synced with Active Directory” (number 1). The meaning is, that the James Office 365 user account, is “bound” to On-Premise Active Directory user account.
  • In the Status column (number 2), we can see that the Office 365 user account doesn’t have a license. This is a “clue” to the fact, that the James Office 365 user account is not the “original user account” because, the original James Office 365 user had an Exchange Online license.

The NEW Office 365 user account that was created – 01

In our example, the Administrator notices that the James Office 365 account, doesn’t have Office 365 licenses,. To be able to “activate” the Office 365 user accounts, he assigns the required Exchange Online license to James Office 365 account.

The NEW Office 365 user account that was created – 02

Exchange Online | The NEW empty Exchange Online mailbox

As mentioned, the James Office 365 user account didn’t have Exchange Online license.
When the Administrator assigns Exchange Online license to the NEW James Office 365 user account, a NEW empty Exchange Online mailbox was created.

View the content of the NEW empty Exchange Online mailbox -01

In our scenario, James connects to his Exchange Online mailbox and starts to send and
receive E-mail messages.

In the following screenshot, we can see that James got an E-mail message from Angelina.

Notice the James mailbox include the “NEW mail” that sent by Angelina but the original Exchange Online mailbox content doesn’t appear!

The Exchange Online mailbox that we “see” is not the original Exchange Online mailbox that was associated with the Soft Deleted Jame’s user account but instead of a NEW empty Exchange Online mailbox.

Later, when we finish the process of merging the data from the “old Soft Deleted Exchange Online mailbox” to the NEW empty Exchange Online mailbox, it will help me to “proof” that the old mail items merged with the NEW mail items.

View the content of the NEW empty Exchange Online mailbox -02

Step 3#3 – fixing the Exchange Online mailbox restore mistake – importing Soft Deleted mailbox content to the NEW empty mailbox using New-MailboxRestoreRequest

In this step, we will use the Exchange Online PowerShell command-
New-MailboxRestoreRequest, for importing (copy) the data that is stored in James Exchange Online Soft Deleted and “paste” the mailbox content to the NEW James Exchange Online mailbox.

PowerShell command syntax that we need to use is:

In our example, we will use New-MailboxRestoreRequest PowerShell command by addressing the [email protected] Exchange mailbox.

Notice the “issue” that we need to deal with –

  • The identifier that we use for addressing the source Exchange Online Soft Deleted mailbox is [email protected]
  • The identifier that we use for addressing the destination NEW empty Exchange Online mailbox is [email protected]
Using the PowerShell command New-MailboxRestoreRequest – the problem -03

The result is the following error:

The operation couldn’t be performed because ‘[email protected]’ matches multiple entries.

Our challenge is – how to differentiate between the two different Exchange Online mailboxes? Both of Soft Deleted Exchange Online mailboxes “identities” is represented by the E-mail address [email protected].

The problem – how to uniquely identify the specific Exchange mailbox

The solution is, to address each of the Exchange Online mailbox by using a
Unique identifier – the GUID (Globally Unique Identifier) value.

We will need to get the GUID value of:

  1. The source Exchange Online mailbox meaning, the Soft Deleted James’s
  2. The Destination James Exchange Online mailbox (the NEW empty Exchange Online mailbox).

The Solution - Referencing the specific Exchange Online mailbox using the GUID value-02

1#2 – Getting the GUID value of the source Exchange Online mailbox

In the following example, we demonstrate how to get the GUID value of the Soft Deleted Exchange Online mailbox

We will use the following PowerShell command:

Notice that we ask from Exchange Online, to “fetch” the information about the Exchange Online from the Exchange Online recycle bin, by using the parameter – SoftDeletedMailbox

Using the PowerShell command New-MailboxRestoreRequest – the solution -01

  • In our example, the GUID value of the source Exchange Online mailbox is –
    4f664109-65b8-4958-89c7-cf9f01f29c31

2#2 – Getting the GUID value of the destination Exchange Online mailbox

We will use the following PowerShell command:

Notice that this time, we ask from Exchange Online, to “fetch information” about “active” Exchange Online mailbox of a user named – James.

Using the PowerShell command New-MailboxRestoreRequest – the solution -03

  • In our example, the GUID value of the destination Exchange Online mailbox is –
    4357604d-341a-4f99-bfbd-9b04edef8273

Running the New-MailboxRestoreRequest PowerShell command.

Now, we can complete the last step, in which we execute the New-MailboxRestoreRequest PowerShell command, that will restore all the mailbox content that is included in a James Soft Deleted mailbox, to the NEW empty James Exchange Online mailbox that was created.

The PowerShell command that we use in our examples is-

Using the PowerShell command New-MailboxRestoreRequest – the solution -04

In the following screenshot, we can see the results.

Notice the interesting thing, the NEW James Exchange Online mailbox, include already some mail items, such as the E-mail that was sent by Angelina.

The New-MailboxRestoreRequest PowerShell command didn’t run over the existing mail items, but instead, “merge” the mail items from the source Exchange Online mailbox with the existing mail items in the destination Exchange Online mailbox.

The NEW Exchange Online mailbox include the resorted E-mails from the Soft Deleted Exchange

Restore Exchange Online mailbox | Article series index

Now it’s Your Turn!
It is important for us to know your opinion on this article

Please rate this

Eyal Doron on EmailEyal Doron on FacebookEyal Doron on GoogleEyal Doron on LinkedinEyal Doron on PinterestEyal Doron on RssEyal Doron on TwitterEyal Doron on WordpressEyal Doron on Youtube
Eyal Doron
Share your knowledge.
It’s a way to achieve immortality.
Dalai Lama

Leave a Reply

Your email address will not be published. Required fields are marked *