1. Install and import module
Import-Module ExchangeOnlineManagement
Install-Module ExchangeOnlineManagement
2. Connect to service
Connect-ExchangeOnline
3. Check
Get-MessageTrace -RecipientAddress test@domain.com -StartDate (Get-Date).Adddays(-30) -EndDate (Get-Date)
Get-MessageTrace -SenderAddress test@domain.com --StartDate (Get-Date).Adddays(-30) -EndDate (Get-Date)
4. Who sent an mail from a shared mailbox:
Search-MailboxAuditLog -Identity "sharedmailbox@domain.com" -ShowDetails | Where {$_.Operation -eq "SendAs"} | Format-Table Operation, OperationResult, LogonUserDisplayName, ItemSubject, LastAccessed –Auto