Office365 Quarantine
If you are wanting to delete Email messages from Office 365 Quarantine using the web portal, it allows you to remove 100 messages at a time. Selecting 100 at a time to be deleted is not an efficient use of time.
Below is a quick way you can delete Quarantine Email messages from Office 365 using the Windows Powershell.
- Open Powershell as Administrator
- Run the following commands;
$UserCredential = Get-Credential
Set-ExecutionPolicy Unrestricted
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
- As we are going to be using Exchange commands, Install & Import the Exchange powershell modules
Install-Module -name ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement
- Almost time to delete the Emails, type the following to check what the Quarantine Contains
Get-QuarantineMessage
- Ok lets nuke the Email Messages, type:
$ids = Get-QuarantineMessage | select -ExpandProperty Identity; Delete-QuarantineMessage -Identities $ids -Identity 000 -Confirm:$false - Check that the Quarantine is empty:
Get-QuarantineMessageIf it still returns a list of Email Messages, run the cmd in Step5 again.
Yes I know you are saying ‘Hey I thought I could delete ALL the emails in one go’. Well sorry you are still limited to 100. Just continue to run the cmd in Step5. But hey, it is still better then having to select 100 messages at a time.
Want to hear more useful tech-tips?
Follow us on LinkedIn, Facebook or Twitter to be notified when we post new content. If you’re not crazy about social media, go ahead and sign up for our newsletter. You can use the form at the bottom of this page. We only send them once a month and you can always unsubscribe.