Forum Discussion
Need to Restore Deleted Mailbox with a twist
- Apr 03, 2019
Solved the issue; turns out, certain cmdlets, such as Get-MailboxDatabase | Get-MailboxStatistics can only be ran from an Exchange Server in the Shell. I perform nearly every Exchange mgmt task from my own machine via Remote Session. ($ExchSession = New-PSSession.... Import-PSSession $ExchSession...). When I run that command in Remote Session, I receive an error: The specified mailbox "DB15" doesn't exist. [Get-MailboxStatistics], ManagementObjectNotFoundException.
I mostly followed the "https://docs.microsoft.com/en-us/exchange/connect-or-restore-a-deleted-mailbox-exchange-2013-help#use-the-shell-to-restore-a-deleted-mailbox" doc.
- From one of our Exchange Servers, I was successfully able to run this cmdlet:
Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisplayName -eq "END USER" } - This returned TWO entries, which is exactly what I expected to see
- I piped that into a Select DisplayName,MailboxGuid,Database,ServerName in order to obtain the original mailbox's source DB info:
Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisplayName -eq "END USER" } | Select DisplayName,MailboxGuid,Database,ServerName - This enabled me to successfully run a New-MailboxRestoreRequest:
New-MailboxRestoreRequest -SourceStoreMailbox "GUID of deleted mailbox" -SourceDatabase MBXDB01 -TargetMailbox "END USER MB" -AllowLegacyDNMismatch - Used this command to check the stats of the restore:
Get-MailboxRestoreRequest | Get-MailboxRestoreRequestStatistics
- From one of our Exchange Servers, I was successfully able to run this cmdlet:
Solved the issue; turns out, certain cmdlets, such as Get-MailboxDatabase | Get-MailboxStatistics can only be ran from an Exchange Server in the Shell. I perform nearly every Exchange mgmt task from my own machine via Remote Session. ($ExchSession = New-PSSession.... Import-PSSession $ExchSession...). When I run that command in Remote Session, I receive an error: The specified mailbox "DB15" doesn't exist. [Get-MailboxStatistics], ManagementObjectNotFoundException.
I mostly followed the "https://docs.microsoft.com/en-us/exchange/connect-or-restore-a-deleted-mailbox-exchange-2013-help#use-the-shell-to-restore-a-deleted-mailbox" doc.
- From one of our Exchange Servers, I was successfully able to run this cmdlet:
Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisplayName -eq "END USER" } - This returned TWO entries, which is exactly what I expected to see
- I piped that into a Select DisplayName,MailboxGuid,Database,ServerName in order to obtain the original mailbox's source DB info:
Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisplayName -eq "END USER" } | Select DisplayName,MailboxGuid,Database,ServerName - This enabled me to successfully run a New-MailboxRestoreRequest:
New-MailboxRestoreRequest -SourceStoreMailbox "GUID of deleted mailbox" -SourceDatabase MBXDB01 -TargetMailbox "END USER MB" -AllowLegacyDNMismatch - Used this command to check the stats of the restore:
Get-MailboxRestoreRequest | Get-MailboxRestoreRequestStatistics