-
Notifications
You must be signed in to change notification settings - Fork 0
/
Save-MailboxData.ps1
27 lines (14 loc) · 991 Bytes
/
Save-MailboxData.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#Connect to Exchange Online
Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
#Check if there is a mailbox availible for restore
Get-mailbox -SoftDeletedMailbox
#Get details of the mailbox you want to restore
Get-Mailbox -SoftDeletedMailbox -Identity <NAME OF THE MAILBOX YOU WANT TO RESTORE> | FL Name,ExchangeGuid,PrimarySmtpAddress
#Get details of the mailbox where you want to restore to
Get-Mailbox -Identity <EMAIL ADRES OF THE NEW MAILBOX> | FL Name,ExchangeGuid,PrimarySmtpAddress
#Create Restore with the details found above
New-MailboxRestoreRequest -SourceMailbox e2702dd5-8b61-41dc-a94b-a18f5c4f3f1f -TargetMailbox d0986785-8ebc-4378-9be5-5f9a3f4e3ec9 -AllowLegacyDNMismatch
#Check status of the restore
Get-MailboxRestoreRequest