Soft deleted and hard deleted mailbox

Gurudas 951 Reputation points
2022-05-31T09:13:54.187+00:00

Pls explain below powershell commands.

Remove-MsolUser -UserPrincipalName <Walter Harp> -RemoveFromRecycleBin

Undo-SoftDeletedMailbox allieb@Company portal .com -WindowsLiveID allieb@Company portal .com -Password (ConvertTo-SecureString -String 'Pa$$word1' -AsPlainText -Force)

Get-Mailbox -SoftDeletedMailbox | Select-Object Name,ExchangeGuid

Get-Mailbox -Identity <NameOrAliasOfNewTargetMailbox> | Format-List ExchangeGuid

Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -eq "Disabled"} | Format-Table DisplayName,MailboxGuid,LegacyDN,Database

Get-Mailbox -Identity "<MailboxIdentity>" | Format-List Name,ExchangeGuid,LegacyExchangeDN

New-MailboxRestoreRequest -RemoteRestoreType DisconnectedMailbox -RemoteHostName <ServerFQDN> -RemoteCredential (Get-Credential) -RemoteDatabaseGuid <GUID> -SourceStoreMailbox <MailboxGUID> -TargetMailbox <ExchangeGUID>

Get-MailboxRestoreRequestStatistics -Identity <MailboxRestoreRequestIdentity> -IncludeReport

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,178 questions
Windows for business | Windows Server | User experience | PowerShell
{count} votes

Accepted answer
  1. Joyce Shen - MSFT 16,701 Reputation points
    2022-06-01T02:28:01.927+00:00

    Hi @Gurudas

    You could check the complete steps introduced here: Delete or restore user mailboxes in Exchange Online

    Remove-MsolUser -UserPrincipalName <Walter Harp> -RemoveFromRecycleBin
    This command removes Walter Harp from the Azure Active Directory recycle bin. The command prompts you to confirm the operation. This command permanently removes the user.

    Undo-SoftDeletedMailbox allieb@Company portal .com -WindowsLiveID allieb@Company portal .com -Password (ConvertTo-SecureString -String 'Pa$$word1' -AsPlainText -Force)
    This command recovers the deleted mailbox for the user allieb@Company portal .com. When this mailbox was deleted, the associated Microsoft account (formerly known as a Windows Live ID) wasn't deleted. Note that a new Microsoft account and password have to be created to recover this mailbox. In the scenario, the old Microsoft account is retained as a proxy address for the mailbox.

    Get-Mailbox -SoftDeletedMailbox | Select-Object Name,ExchangeGuid
    This command is used to identify the soft-deleted mailbox that you want to restore
    The SoftDeletedMailbox switch is required to return soft-deleted mailboxes in the results.

    Get-Mailbox -Identity <NameOrAliasOfNewTargetMailbox> | Format-List ExchangeGuid
    This command is used to to get the GUID value of the target mailbox

    Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -eq "Disabled"} | Format-Table DisplayName,MailboxGuid,LegacyDN,Database
    This command is used to show the required MailboxGuid value of the disconnected mailbox

    Get-Mailbox -Identity "<MailboxIdentity>" | Format-List Name,ExchangeGuid,LegacyExchangeDN
    This command is used to show the required ExchangeGuid value

    New-MailboxRestoreRequest -RemoteRestoreType DisconnectedMailbox -RemoteHostName <ServerFQDN> -RemoteCredential (Get-Credential) -RemoteDatabaseGuid <GUID> -SourceStoreMailbox <MailboxGUID> -TargetMailbox <ExchangeGUID>
    This command is used to restore to Exchange Online mailbox

    Get-MailboxRestoreRequestStatistics -Identity <MailboxRestoreRequestIdentity> -IncludeReport
    This command is used to view detailed information about restore requests
    The IncludeReport switch specifies whether to return additional details, which can be used for troubleshooting.


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.