Friday, 4 April 2025

Search an email in a mailbox and export to another mailbox through search-mailbox

Mathod 1: first export the contents to targent mailbox and check. Get-Mailbox -Identity "A.I@I.Co" | Search-Mailbox -SearchQuery {sent:01/04/2022..12/20/2022} -TargetMailbox mnk-da@i.co -TargetFolder "ai" if all ok, run the following command to delete. Get-Mailbox -Identity "A.I@I.Co" | Search-Mailbox -SearchQuery {sent:01/04/2022..12/20/2022} -TargetMailbox mnk-da@i.co -TargetFolder "ai" -DeleteContent Mathord 2: get-mailbox nawaz@i.co | search-mailbox -searchquery "subject: thisissubject" -targetmailbox mnk-da@i.co -targetfolder "nawazfolder" Example: working fine... the email were exported to the target mailbox and were appearing in the target folder [PS] C:\Windows\system32>get-mailbox mnawaz.k@I.co | search-mailbox -searchquery "subject: 'friday'" -targetmailbo x mnk-da@I.co -targetfolder "nawazfolder" WARNING: The Search-Mailbox cmdlet returns up to 10000 results per mailbox if a search query is specified. To return more than 10000 results, use the New-MailboxSearch cmdlet or the In-Place eDiscovery & Hold console in the Exchange Administration Center. RunspaceId : 791886ab-1814-4072-89a9-127dbb186537 Identity : c.Ig.com/Sites/_g/Users/kmn TargetMailbox : c.Ig.com/g/Users/O365 Users/kmn Success : True TargetFolder : \nawazfolder\kmn-12/15/2022 1:36:26 PM ResultItemsCount : 2 ResultItemsSize : 71.48 KB (73,200 bytes)

No comments:

Post a Comment