Search and Delete specific message from all mailboxes Exchange 2010
First user account that you will perform this function must have specific rights
Execute the command below ( I am going to use administrator account)
Add-RoleGroupMember "Discovery Management" -Member "administrator"
Execute the command below ( I am going to use administrator account)
New-Managementroleassignment -Role "Mailbox Import Export" -User "Administrator"
After Adding Permission you should close and reopen EMS console
Search and Delete
Get-mailbox | search-mailbox -searchquery "Subject:'MustbeDeleted'" -DeleteContent
Command is going to request confirmation for operate type= A [Yes to All]
Note: Target mailbox you indicated below will not be searched for keywords
If you get error like below;
a positional parameter cannot be found that accepts argument
Close and reopen EMS console.
If you get error like below;
The property keyword isn’t supported
Remove RE: or FW: from subject part in the command than try command again.
Subject must be indicated completely and properly in order command to operate.
Other Search Parameters
Ex. attachment:report.pptx
Ex. cc:paul shen or cc:pauls or cc:pauls@contoso.com
Ex. from:bharat suneja or from:bsuneja or from:bsuneja@contoso.com
Ex. sent:yesterday
Multiple Parameters Example
[PS] C:\Windows\system32>Get-mailbox | search-mailbox -searchquery "Subject:'mustbedeleted' AND Received: > $('07/08/2014 10:00:00') AND Received: < $('07/08/2014 11:00:00')" -DeleteContent
Get-mailbox | search-mailbox -searchquery 'from:"no-reply@sharepoint.com"' -DeleteContent
Mailbox Search Role This role allows you to search for messages across multiple mailboxes in your organization. Administrators aren’t assigned this role by default. To search multiple mailboxes, add yourself as a member of the Discovery Management role group.
Mailbox Import Export Role This role allows you to delete messages from a user’s mailbox. This role isn’t assigned to administrators by default. To delete messages from users’ mailboxes, add the Mailbox Import Export role to the Organisation Management role group.
Automated Script
http://gallery.technet.microsoft.com/Simplying-Discovery-Search-1fbfde94
Thursday, January 23, 2014
Search and Delete specific message from all mailboxes Exchange 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment