Discovery Mailbox Search Exclude External Mail Export to PST

This Exports a report of emails and also a copy of all the emails to a mailbox ( Disovery ) you can do this via the Web Based Gui : https://youwebmaildomain/ecp/?rfr=owa with the right user permissions

New-MailboxSearch -Name "WeekendOutage-Search" -StartDate "1/1/2009" -EndDate "12/31/2009" -SourceMailboxes "Amit Tank" -TargetMailbox "Discovery Search Mailbox" -SearchQuery '"Weekend" and "Outage"' -MessageTypes Email -IncludeUnsearchableItems -LogLevel Full

But you cannot exclude emails from specific domains from this discovery search .e.g only sent from Externally. You can exclude Generic Keywords using NOT in the -SearchQuery but its generic to the email like the search Query above.

The New-MailboxExportRequest Should be able to do this but it doesn’t , just exports everything probably because the operator is too specific and doesn’t suport -notlike 🙁

New-MailboxExportRequest -Mailbox "Discovery Search Mailbox" -contentfiler{sender -ne "*@internaldomain.com"} -Filepath \\samba\share\withexchangepermissions\file.pst

But we can actually just delete all the Internal Mail using Search Mailbox

 

Search-Mailbox -Identity "Discovery Search Mailbox" -searchquery 'From:"@internaldomain.com"' -DeleteContent

Now we can just export this to a PST

New-MailboxExportRequest -Mailbox "Discovery Search Mailbox" -Filepath \\samba\share\withexchangepermissions\file.pst
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 8.00 out of 5)
Loading...