So basically people sometimes call & say something about not receiving an email from someone or they think that emails are getting blocked by spam.
So wrote a small script that will connect to Exchange Online & then prompt for the amount of days back you want to check for spam and also which user.
The script then exports it to a CSV file & opens it for you so you can view it.
#You need the ExchangeOnlineManagmenet module installed in powershell #Install-Module -Name ExchangeOnlineManagement #Import exchange Import-Module ExchangeOnlineManagement Connect-ExchangeOnline #set todays date and the amount of time to seach back $today = Get-Date $DaysBack = Read-Host -Prompt 'Input the days you want to go back' #set the amount of days you want to go back $yesterday = (get-date).AddDays(-$DaysBack) # set who's mailbox you want to check $recipient = Read-Host -Prompt 'Enter users email' #mark status you want to search for $Status = "FilteredAsSpam" Get-MessageTrace -StartDate $yesterday -EndDate $today -RecipientAddress $recipient -Status $Status | Select MessageID,Received,*Address,*IP,Subject,Status,Size | Format-Table Invoke-Item C:\Temp\SpamResults.csv