How to Recover Emails in Microsoft 365 with PowerShell
Email has become a powerful tool for communication both in the workplace and in our personal lives. As with any technology, there are times when emails get lost or deleted, and Microsoft 365 users may find themselves needing to recover those emails. Fortunately, Microsoft 365 has a built-in feature that makes it easy to recover emails with PowerShell.
What is PowerShell?
PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language. It provides users with a powerful way to automate and manage their Microsoft 365 environment. PowerShell is included in all versions of Microsoft 365, and it can be used to manage mailboxes, configure the environment, and more.
How to Recover Emails in Microsoft 365
The built-in feature in Microsoft 365 that allows users to recover emails is called the Recoverable Items folder. This folder stores all emails that have been deleted in the last 14 days. The emails are stored in the folder until they are permanently deleted or purged. To access the Recoverable Items folder, users must use PowerShell.
Step 1: Connect to Microsoft 365
The first step in recovering emails from Microsoft 365 is to connect to the service using PowerShell. To do this, open a new PowerShell window and type in the following command:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credential -Authentication Basic -AllowRedirection
Replace “$credential” with your Microsoft 365 credentials. This will establish a connection to Microsoft 365 and allow you to run commands in the environment.
Step 2: Get the Emails
Once you are connected to Microsoft 365, you can use the Get-Mailbox cmdlet to retrieve the emails from the Recoverable Items folder. To do this, type in the following command:
Get-Mailbox -IncludeRecoverableItems -Identity “
Step 3: Restore the Emails
Once you have retrieved the emails from the Recoverable Items folder, you can use the Restore-RecoverableItems cmdlet to restore them to their original location. To do this, type in the following command:
Restore-RecoverableItems -Identity “
Microsoft 365 provides a powerful way to recover emails with PowerShell. By using the built-in Recoverable Items folder and the Get-Mailbox and Restore-RecoverableItems cmdlets, users can easily retrieve and restore lost or deleted emails. This feature can be a lifesaver for users who need to recover important emails quickly and easily.
How to recover user emails in Microsoft 365
1.Microsoft 365 email recovery (Search Volume: 1000, Competition: Low)