Message monitoring in Trade On-line could be carried out graphically in addition to in PowerShell. On this submit I’ll present easy methods to monitor messages with PowerShell. And you’re going to get a script which you should utilize in your setting. Let’s soar in.
Stipulations
If not already achieved, we have to set up the Trade On-line Administration Module and hook up with Trade On-line.
Set up-Module ExchangeOnlineManagement -Power -AllowClobber
Join-ExchangeOnline
Message Monitoring in PowerShell
Subsequent, I’ll present you 4 examples of how one can carry out message monitoring for a mailbox to show the output both within the console, in a file, or in a separate window.
Get-MessageTrace -SenderAddress consumer@area.com -StartDate 08/10/2022 -EndDate 08/20/2022 # Max. 10 Tage
Get-MessageTrace -SenderAddress consumer@area.com -StartDate 08/10/2022 -EndDate 08/20/2022 | Out-GridView
Get-MessageTrace -SenderAddress consumer@area.com -StartDate 08/10/2022 -EndDate 08/20/2022 | Out-File $hometrace.txt
Get-MessageTrace -SenderAddress consumer@area.com -StartDate 08/10/2022 -EndDate 08/20/2022 | Export-Csv $hometrace.csv
To show all mails despatched to a selected recipient this command can be utilized.
Get-MessageTrace -RecipientAddress consumer@area.com -StartDate 08/10/2022 -EndDate 08/20/2022
You have no idea precisely the sender or recipient handle? No downside, we will work with wildcards.
Get-MessageTrace -RecipientAddress consumer@area.com -StartDate 08/10/2022 -EndDate 08/20/2022 |
The place-Object SenderAddress -like "*.*udemy*"
Get-MessageTrace -SenderAddress consumer@area.com -StartDate 08/10/2022 -EndDate 08/20/2022 |
The place-Object RecipientAddress -like "*win*"
Be aware that looking for e-mails is restricted to 10 days previously. Nevertheless, there’s a workaround which known as Historic Search.
Begin-HistoricalSearch -ReportTitle "TestSearch" -StartDate 6/1/2022 -EndDate 8/1/2022 -ReportType MessageTrace `
-SenderAddress consumer@area.com -NotifyAddress consumer@area.com
Get-HistoricalSearch
I hope this overview was useful for you.