Delete emails of a specific topic or specific time from exchange2010

Source: Internet
Author: User
Yesterday, I received a call from my colleague on the bus at work, saying that the boss of his department had sent an incorrect email to another colleague's mailbox and asked me if I could delete it from that colleague's mailbox, I have seen the materials on the Internet before. When I arrived at the company, while the colleague who accidentally received the email had not yet arrived, I opened EMS on the server to delete it, I sorted out the commands I used and posted them to you.
1. Grant the Administrator the permission to perform this operation.
New-managementroleassignment-role "Mailbox Import Export"-user administrator

[PS] c: \ windows \ system32> New-managementroleassignment-role "Mailbox importexport"-user administrator

Name role roleassigneename roleassigneetype assignmentmethod implements tiveusername

------------------------------------------------------------------------
Mailbox Import Export-admin... mailboximport... administrator user direct
(After running this command, you must close the EMS to open it. The following search-Mailbox command can be used, which is strange)
2. delete emails with a specific subject or time
1. Deletes an email with a specific email subject.

[PS] c: \ windows \ system32> Search-Mailbox-identity chenguang. Yang-searchquery "Topic: New Company Registration"-deletecontent

Confirm
Deleting content from chenguang. Yang
[Y] Yes (y) [a] All (a) [N] No (n) [l] No (l) [?] Help (the default value is "Y"):


Runspaceid: 67c8464c-a32a-4ad2-a75a-a5842a146107
Identity: hangxun.com.cn/infowarelab/operations engineering/hosting dB/chenguang Yang
Displayname: chenguang Yang
Targetmailbox:
Targetpstfile:
Success: True
Targetfolder:
Resultitemscount: 2
Resultitemssize: 3.125 KB (3,200 bytes)

2. Delete emails in a specific mailbox for a certain period of time
2.1 Delete all emails before a specified mailbox time point,
For example, all emails before January 1, August 24, 2012
[PS] c: \ windows \ system32> Search-Mailbox-identity chenguang. Yang-searchquery "sent at: <2012/08/24"-deletecontent

Confirm
Deleting content from chenguang. Yang
[Y] Yes (y) [a] All (a) [N] No (n) [l] No (l) [?] Help (default value: "Y"): Y


Runspaceid: 67c8464c-a32a-4ad2-a75a-a5842a146107
Identity: hangxun.com.cn/infowarelab/operations engineering/hosting dB/chenguang Yang
Displayname: chenguang Yang
Targetmailbox:
Targetpstfile:
Success: True
Targetfolder:
Resultitemscount: 355
Resultitemssize: 10.6 MB (11,116,864 bytes)

2.2 For example, all emails sent on January 1, August 24, 2012
[PS] c: \ windows \ system32> Search-Mailbox-identity chenguang. Yang-searchquery "sent at: = 2012/08/24"-deletecontent

Confirm
Deleting content from chenguang. Yang
[Y] Yes (y) [a] All (a) [N] No (n) [l] No (l) [?] Help (default value: "Y"): Y


Runspaceid: 67c8464c-a32a-4ad2-a75a-a5842a146107
Identity: hangxun.com.cn/infowarelab/operations engineering/hosting dB/chenguang Yang
Displayname: chenguang Yang
Targetmailbox:
Targetpstfile:
Success: True
Targetfolder:
Resultitemscount: 2
Resultitemssize: 11.99 KB (12,274 bytes)



2.3 For example, all emails after January 1, June 26, 2013
[PS] c: \ windows \ system32> Search-Mailbox-identity chenguang. Yang-searchquery "sent at:> 2013/06/26"-deletecontent

Confirm
Deleting content from chenguang. Yang
[Y] Yes (y) [a] All (a) [N] No (n) [l] No (l) [?] Help (default value: "Y"): Y


Runspaceid: 67c8464c-a32a-4ad2-a75a-a5842a146107
Identity: hangxun.com.cn/infowarelab/operations engineering/hosting dB/chenguang Yang
Displayname: chenguang Yang
Targetmailbox:
Targetpstfile:
Success: True
Targetfolder:
Resultitemscount: 10
Resultitemssize: 128.4 KB (131,489 bytes)

2.4 for example, all emails between January 1, August 23-20, 2012 and January 1, August 24
[PS] c: \ windows \ system32> Search-Mailbox-identity chenguang. Yang-searchquery "sent at: <2012/08/24 and 2012/08/23"-deletecontent

Confirm
Deleting content from chenguang. Yang
[Y] Yes (y) [a] All (a) [N] No (n) [l] No (l) [?] Help (default value: "Y"): Y


Runspaceid: 67c8464c-a32a-4ad2-a75a-a5842a146107
Identity: hangxun.com.cn/infowarelab/operations engineering/hosting dB/chenguang Yang
Displayname: chenguang Yang
Targetmailbox:
Targetpstfile:
Success: True
Targetfolder:
Resultitemscount: 0
Resultitemssize: 0 B (0 bytes)

Here, I checked the deleted emails, and even the emails at the corresponding time in the deleted folder were deleted.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.