Delete all Email Messages from Office365 Quarantine *FAST Pro Edition


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.  

  1. Open Powershell as Administrator
  2. Run the following commands;

    $UserCredential = Get-Credential

    Set-ExecutionPolicy Unrestricted

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection

    Import-PSSession $Session
    Office 365 Quarantine

  3. As we are going to be using Exchange commands, Install & Import the Exchange powershell modules

    Install-Module -name ExchangeOnlineManagement

    Import-Module ExchangeOnlineManagement
    import exchange modules into powershell

  4. Almost time to delete the Emails, type the following to check what the Quarantine Contains


    check office365 email quarantine

  5. Ok lets nuke the Email Messages, type:
    $ids = Get-QuarantineMessage | select -ExpandProperty Identity; Delete-QuarantineMessage -Identities $ids -Identity 000 -Confirm:$false

    delete all emails from quarantine

  6. Check that the Quarantine is empty:

    If 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.

Want to stay up to date with useful tech-tips?  

Follow us on LinkedIn, Facebook or Twitter to be notified when we post new content. Or, even better, scroll down to the very bottom of this page to sign up for our Newsletter. We only send them once a month and you can always unsubscribe.