Email search quarentine via Powershell

IN order to do a bulk searching for a domain in Quarantine in Office365 you must use Power-Shell:

  • Open PowerShell with Admin Privileges
  • type: Set-ExecutionPolicy RemoteSigned
  • type $UserCredential = Get-Credential          (Login with user with Admin Rights)
  • type $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
  • type Import-PSSession $Session -DisableNameChecking

You are now connected to Office365

To get the emails from a specific Domain:

  • type 

Get-QuarantineMessage -StartReceivedDate 01/1/2020 -EndReceivedDate 02/18/2020| ? {$_.Senderaddress -like "*@elekta.com"}

Replace elekta.com with the domian you are using and change the startreceiveddate and endrecievedate