Exchange Online, Office 365, Powershell

Search-Mailbox in Exchange Online

WARNING: On July 1, 2020, the Search-Mailbox cmdlet is being retired and Microsoft Support will
no longer provide assistance. See to learn more

1. Connect Exchange Online – Connect ExchangeOnline
2. Run the following cmdlets

New-RoleGroup "Mailbox Import-Export Management" -Roles "Mailbox Import Export"
Add-RoleGroupMember "Mailbox Import-Export Management" -Member "youremail"

3. Close and re-connect Exchange Online
4. Run search command in similar format as below:

Search-Mailbox -Identity -SearchQuery 'Subject:"testsearch" AND AND Received:"06/28/2020 00:00..06/28/2020 23:59"' -TargetMailbox "" -TargetFolder "search" -LogOnly -LogLevel Full