Procedure to copy  the data from Deleted Mailbox to Active Mailbox.

  1. Start Windows PowerShell

    Start > search for "PowerShell" > Start Windows PowerShell by clicking on "Run as Administrator".

  2.  Connect the Windows PowerShell to Office 365 Exchange Online. Please execute below command in PowerShell.
    $LiveCred = Get-Credential (Supply Exchange Online Admin’s log in credentials in the prompt window)
    Set-ExecutionPolicy Unrestricted (Proceed with Y if prompted)
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $LiveCred -Authentication Basic -AllowRedirection
    Import-PSSession $Session
  3. Verify if the old mailbox is in deleted state.
    Get-Mailbox -SoftDeletedMailbox accounts
  4. If the Mailbox is found collect the ExchangeGuid of the deleted Mailbox.
    (Get-Mailbox -SoftDeletedMailbox ).ExchangeGuid
  5. Collect the ExchangeGuid of the Active Mailbox.
  6. Now copy the data from the deleted mailbox to the new Mailbox.
    • New-MailboxRestoreRequest -SourceMailbox "Guid of Deleted Mailbox copied from step 4" -TargetMailbox "Guid of Deleted Mailbox copied from step 5"  -AllowLegacyDNMismatch -verbose
  7. Monitor the same.
    • Get-MailboxRestoreRequest
  8. Once it is completed all the data would be moved to the new one.


Sample with Regular PowerShell

1)  Verify the active Mailbox.

Get-Mailbox ACTIVE_USER_ALIAS | FL  Name,Alias,UserPrincipalName,ExchangeGuid,Guid,EmailAddresses,Database

2)  Verified the same in the soft deleted list.

Get-Mailbox -SoftDeletedMailbox Deleted_User_Alias | FL Name,Alias,UserPrincipalName,ExchangeGuid,Guid,EmailAddresses,Database

3)  Collect the data about the mailboxes.

Active Mailbox.

Get-Mailbox ACTIVE_USER_ALIAS | FL Name,Alias,UserPrincipalName,ExchangeGuid,Guid,EmailAddresses,Database
UserPrincipalName :
ExchangeGuid  : b09181cd-9183-4036-8946-9339dfa27702
Guid  : 28101858-670e-4b47-aedc-7f9cc583a80dEmailAddresses  : {,,}

Deleted Mailbox.

Get-Mailbox -SoftDeletedMailbox Deleted_User_Alias | FL
Name  : Deleted_User_Alias
Alias  : Deleted_User_Alias
UserPrincipalName :
ExchangeGuid  : b4dc2e0c-d2ba-4524-9722-dd279b6c6f61
Guid  : a3d02e59-60fd-4bca-b9ca-609c2f792891
EmailAddresses  : {SIP:ecbb89072dda4219a644fab1b054efa6;}

Creating the Mailbox restore request.

New-MailboxRestoreRequest -SourceMailbox b4dc2e0c-d2ba-4524-9722-dd279b6c6f61 -TargetMailbox b09181cd-9183-4036-8946-9339dfa27702 -AllowLegacyDNMismatch -Verbose

Once Request created successfully confirmed the batch completed successfully.

Get-MailboxRestoreRequest | FL Identity,requestguid,Status

Sample with GUI with the help of ISE PowerShell

  1. Start the “Windows PowerShell ISE”, connect it to Exchange Online and Execute below commands.
  2. This would show the list of SoftDeletedMaiboxes, please select one in question and click OK (@ Bottom).  $DeletedMailbox = Get-Mailbox -SoftDeletedMailbox | Select DisplayName,ExchangeGuid,PrimarySmtpAddress,ArchiveStatus,DistinguishedName | Out-GridView -Title " This is the list of SoftDeletedMaiboxes, please select one." -PassThru
  3. Select the Target Mailbox to which the data needs to be moved.
    1.  $MergeMailboxTo = Get-Mailbox | Select Name,PrimarySmtpAddress,DistinguishedName | Out-GridView -Title " Select the Target Mailbox to which the data needs to be moved." –PassThru
    2. Run the Merge Command

       New-MailboxRestoreRequest -SourceMailbox $DeletedMailbox.DistinguishedName -TargetMailbox $MergeMailboxTo.PrimarySmtpAddress –AllowLegacyDNMismatch

  4. View the progress
  5. Grab the restore ID for the one you want progress on.
    • $RestoreProgress = Get-MailboxRestoreRequest | Select Name,TargetMailbox,Status,RequestGuid | Out-GridView -Title "Restore Request List" –PassThru 
  6.  Get the progress in Percent complete.
    • Get-MailboxRestoreRequestStatistics -Identity $RestoreProgress.RequestGuid | Select Name,StatusDetail,TargetAlias,PercentComplete