Share via


PowerShell Script to identify Quarantine Message From Specific Domain


PowerShell Script to identify Quarantine Message From Specific Domain


Summary

This TechNet Wiki is based on the TechNet Forum Post - Trying to create script for EOP quarantine filter

Requirement

Need a PowerShell Script to identify Quarantine message from specific domain I would like to create a small PowerShell script which should search sender domain whose email blocked in the office 365 EOP quarantine mailbox and send email alert to Admin by checking after 3-4 hrs. with the details like received time sender email address and recipient email address

Help

help Get-QuarantineMessage -Detailed

help Get-QuarantineMessage -Parameter StartReceivedDate

help Get-QuarantineMessage -Parameter EndReceivedDate

help about_Pipelines

help Where-Object

Solution

Get-QuarantineMessage -StartReceivedDate 09/25/2014 -EndReceivedDate 09/26/2014 | 
 ? {$_.senderaddress -like '*oval-rms.com'}

Explanation

Above help commands will give more insight. In our code we used two parameters start received date and end received date for a day interval and selecting specific domain in Quarantine.

help Export-csv -Detailed

help Send-MailMessage -Detailed

By using the above two commands we can export the report to CSV and send as attachment in email