This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Import-Module ExchangeOnlineManagement | |
| #EnableSearchOnlySession switch is only availabe in ExchangeOnlineManagement version 3.9.0 | |
| Connect-IPPSSession -UserPrincipalName <<adminEmailAddress>> -EnableSearchOnlySession | |
| $Search=New-ComplianceSearch -Name "Remove Email Sent on <<Date>>" -ExchangeLocation All -ContentMatchQuery '(Received:<<FromDate>>..<<ToDate>>) AND (Subject:"<<Subject>>")' | |
| Start-ComplianceSearch -Identity $Search.Identity | |
| #run this after sometime | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | SET ANSI_NULLS ON; | |
| SET ANSI_PADDING ON; | |
| SET ANSI_WARNINGS ON; | |
| SET ARITHABORT ON; | |
| SET CONCAT_NULL_YIELDS_NULL ON; | |
| SET QUOTED_IDENTIFIER ON; | |
| SET STATISTICS IO OFF; | |
| SET STATISTICS TIME OFF; | |
| GO |