Connect
PowerShell to Exchange Online using below command:
$LiveCred =
Get-Credential
$Session =
New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri
https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential
-Authentication Basic –AllowRedirection
Import-PSSession
$Session
Then
checked the old user in Soft Delete
Get-Mailbox
–SoftDeletedMailbox //Check the deleted
user details
Get-mailbox
–SoftDeletedMailbox –Identity “Name of the mailbox” | fl *guid*
Copy the
GUID (not Exchange GUID) in a notepad (1)
Get-mailbox
–Identity “Email address of the new user” | fl *guid*
Copy the
GUID (2)
Following
command will copy the old mailbox’s email to the new mailbox.
New-MailboxRestoreRequest
-SourceMailbox "GUID (1)" -TargetMailbox "GUID (2)"
-TargetRootFolder "Old Mailbox" –AllowLegacyDNMismatch
Since
user had Archive enabled we restored the archive mailbox seperately
We ran the
below commands to get the ArchiveGuid
Get-Mailbox
-Identity user@domain.com -SoftDeletedMailbox |fl " ArchiveGuid"
Get-Mailbox
-Identity user@domain.com |fl "ArchiveGuid"
New-MailboxRestoreRequest
-SourceMailbox "GUID (1)" -TargetMailbox "GUID (2)"
-TargetRootFolder "Old Mailbox" –AllowLegacyDNMismatch
No comments:
Post a Comment