Before you run the Multi-Mailbox search, first you need to add the Office 365 Administrator as a member to Discovery Management, Recipient Management, Compliance Management and Organization Management along with Mailbox Import-Export and Mailbox Search roles under Discovery Management by following the steps below:
- Login to Office 365 portal and go to Exchange Admin Center
- Select the Permissions tab and under Admin Roles, add the Office 365 Administrator as a member of Discovery Management, Recipient Management, Compliance Management and Organization Management groups.
- Under Discovery Management, make sure to add the roles for Mailbox Search and Mailbox Import Export IF you have just added yourself as the admin into the groups above, logo out of the O365 console and back in to make sure the new roles are applied properly.\
- Now go into Compliance Management and choose in-place eDiscovery.
- Create a new search, named appropriately, and set your Search parameters.
- Filter Based on Criteria
- Enter your text in the field
- Specify Start and End dates if you have them
- Specify who it was from if you can
- Run the Search, Preview your results, tweak it to where you have what you need and then switch over to Powershell to finish the exercise.
- Run Powershell as Administrator
- Run ‘Set-ExecutionPolicy Unrestricted’ and continue with ‘Y’
- Now open your session with the following: $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
- That will challenge you for your credentials and connect you.
- Now import the session with: Import-PSSession $Session
- Then you can delete your rogue email with this:Â Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery ""Subject:'Your Subject Here'"" -DeleteContent
It will come up with a chance to confirm each Mailbox or All Mailboxes, I chose A for All Mailboxes and let it go.!! Choosing A for this command does not give any further chance to review so make sure you have your Search narrowed down sufficiently so as to not inadvertently delete something important. You have been warned.Powershell should show a dialog with your successes at this point.