如何删除exchange中用户邮件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何删除exchange中用户邮件相关的知识,希望对你有一定的参考价值。
1,按邮件主题删除特定用户特定邮件:以下示例为删除用户sky里的邮件主题含有'Product Discussion'关键字的邮件。
Search-Mailbox -Identity "sky" -SearchQuery "Subject:'Product Discussion'" -DeleteContent
执行命令结果如下:
[PS] C:\Windows\system32>Search-Mailbox -Identity "sky" -SearchQuery "Subject:'Product Discussion'" -DeleteContent
Confirm
Deleting content from mailboxes sky
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
RunspaceId : b76da44c-a58b-4fdd-b258-8e6031d0899b
Identity : pugster.com/Pugster Users/China Shanghai/Sky Chen
TargetMailbox :
TargetPSTFile :
Success : True
TargetFolder :
ResultItemsCount : 619
ResultItemsSize : 5.43 MB (5,694,285 bytes)
2,按发信人地址删除特定用户特定邮件:
以下示例为删除用户sky里的发信人为'sharepoint@pugster.com'的邮件。
Search-Mailbox -Identity "sky" -SearchQuery "From:'sharepoint@pugster.com'" -DeleteContent
删除来自某一邮箱的某一时间段的邮件;
Search-Mailbox -Identity "sky" -SearchQuery "From:'sharepoint@pugster.com' and Received:01/01/2001..11/01/2011" -DeleteContent
执行命令结果如下:
[PS] C:\Windows\system32>Search-Mailbox -Identity "sky" -SearchQuery "From:'sharepoint@pugster.com'" -DeleteContent
Confirm
Deleting content from mailboxes sky
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
RunspaceId : b76da44c-a58b-4fdd-b258-8e6031d0899b
Identity : pugster.com/Pugster Users/China Shanghai/Sky Chen
TargetMailbox :
TargetPSTFile :
Success : True
TargetFolder :
ResultItemsCount : 2259
ResultItemsSize : 17.72 MB (18,578,615 bytes)
3,按信件内容关键字删除特定用户特定邮件:
以下示例为删除用户sky里的邮件内容里含有为Modify my alert settings的邮件。(因为sharepoint里更换发信人只是最近一个月的事,以前的sharepoint邮件要进行更仔细的甄别。)
Search-Mailbox -Identity "sky" -SearchQuery "body:'Modify my alert settings'" -DeleteContent
执行命令结果如下:
[PS] C:\Windows\system32>Search-Mailbox -Identity "sky" -SearchQuery "body:'Modify my alert settings'" -DeleteContent
Confirm
Deleting content from mailboxes sky
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
RunspaceId : ed49ff14-6c0a-47b2-8fe4-ccda75b10986
Identity : pugster.com/Pugster Users/China Shanghai/Sky Chen
TargetMailbox :
TargetPSTFile :
Success : True
TargetFolder :
ResultItemsCount : 1345
ResultItemsSize : 10.66 MB (11,175,123 bytes)
详细信息请查看:http://msdn.microsoft.com/en-us/library/ee693615.aspx
在Exchange上设置脚本命令批量删除邮件;
$end = (Get-Date).AddDays(-10)
##设置删除时间为10天前
$UserItems='Ciro','sunny','lilian','annie'
##本想写循环导出,但清理范围只限于army服务器,且很多帐号不用于sharepoint,还有部份帐号有小小问题,所以第一次就索性导出列表之后,手工定义邮件用户数组
for($i=0;$i –lt $UserItems.Length;$i++)
$UserItem=$UserItems[$i]
Search-Mailbox -Identity $UserItem -SearchQuery "From:'sharepoint@pugster.com' and Received:<$end" -DeleteContent -Force
##按发信人sharepoint@pugster.com为特征,删除10天前sharepoint邮件
Search-Mailbox -Identity $UserItem -SearchQuery "Subject:'sharepoint calling you' and Received:<$end" -DeleteContent -Force
##按邮件标题sharepoint calling you为特征,删除10天前sharepoint邮件
Search-Mailbox -Identity $UserItem -SearchQuery "Body:'Modify my alert settings' and Received:<$end" -DeleteContent -Force
##由于在sharepoint升级这些特征之前,各个bbs特征并不统一,故取出body含有Modify my alert settings关銉字来删除10天前sharepoint邮件 参考技术A 1,按邮件主题删除特定用户特定邮件:
以下示例为删除用户sky里的邮件主题含有'Product Discussion'关键字的邮件。
Search-Mailbox -Identity "sky" -SearchQuery "Subject:'Product Discussion'" -DeleteContent
执行命令结果如下:
[PS] C:\Windows\system32>Search-Mailbox -Identity "sky" -SearchQuery "Subject:'Product Discussion'" -DeleteContent
Confirm
Deleting content from mailboxes sky
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
RunspaceId : b76da44c-a58b-4fdd-b258-8e6031d0899b
Identity : pugster.com/Pugster Users/China Shanghai/Sky Chen
TargetMailbox :
TargetPSTFile :
Success : True
TargetFolder :
ResultItemsCount : 619
ResultItemsSize : 5.43 MB (5,694,285 bytes)
2,按发信人地址删除特定用户特定邮件:
以下示例为删除用户sky里的发信人为'sharepoint@pugster.com'的邮件。
Search-Mailbox -Identity "sky" -SearchQuery "From:'sharepoint@pugster.com'" -DeleteContent
删除来自某一邮箱的某一时间段的邮件;
Search-Mailbox -Identity "sky" -SearchQuery "From:'sharepoint@pugster.com' and Received:01/01/2001..11/01/2011" -DeleteContent
执行命令结果如下:
[PS] C:\Windows\system32>Search-Mailbox -Identity "sky" -SearchQuery "From:'sharepoint@pugster.com'" -DeleteContent
Confirm
Deleting content from mailboxes sky
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
RunspaceId : b76da44c-a58b-4fdd-b258-8e6031d0899b
Identity : pugster.com/Pugster Users/China Shanghai/Sky Chen
TargetMailbox :
TargetPSTFile :
Success : True
TargetFolder :
ResultItemsCount : 2259
ResultItemsSize : 17.72 MB (18,578,615 bytes)
3,按信件内容关键字删除特定用户特定邮件:
以下示例为删除用户sky里的邮件内容里含有为Modify my alert settings的邮件。(因为sharepoint里更换发信人只是最近一个月的事,以前的sharepoint邮件要进行更仔细的甄别。)
Search-Mailbox -Identity "sky" -SearchQuery "body:'Modify my alert settings'" -DeleteContent
执行命令结果如下:
[PS] C:\Windows\system32>Search-Mailbox -Identity "sky" -SearchQuery "body:'Modify my alert settings'" -DeleteContent
Confirm
Deleting content from mailboxes sky
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
RunspaceId : ed49ff14-6c0a-47b2-8fe4-ccda75b10986
Identity : pugster.com/Pugster Users/China Shanghai/Sky Chen
TargetMailbox :
TargetPSTFile :
Success : True
TargetFolder :
ResultItemsCount : 1345
ResultItemsSize : 10.66 MB (11,175,123 bytes)
详细信息请查看:http://msdn.microsoft.com/en-us/library/ee693615.aspx
在Exchange上设置脚本命令批量删除邮件;
$end = (Get-Date).AddDays(-10)
##设置删除时间为10天前
$UserItems='Ciro','sunny','lilian','annie'
##本想写循环导出,但清理范围只限于army服务器,且很多帐号不用于sharepoint,还有部份帐号有小小问题,所以第一次就索性导出列表之后,手工定义邮件用户数组
for($i=0;$i –lt $UserItems.Length;$i++)
$UserItem=$UserItems[$i]
Search-Mailbox -Identity $UserItem -SearchQuery "From:'sharepoint@pugster.com' and Received:<$end" -DeleteContent -Force
##按发信人sharepoint@pugster.com为特征,删除10天前sharepoint邮件
Search-Mailbox -Identity $UserItem -SearchQuery "Subject:'sharepoint calling you' and Received:<$end" -DeleteContent -Force
##按邮件标题sharepoint calling you为特征,删除10天前sharepoint邮件
Search-Mailbox -Identity $UserItem -SearchQuery "Body:'Modify my alert settings' and Received:<$end" -DeleteContent -Force
##由于在sharepoint升级这些特征之前,各个bbs特征并不统一,故取出body含有Modify my alert settings关銉字来删除10天前sharepoint邮件
以上是关于如何删除exchange中用户邮件的主要内容,如果未能解决你的问题,请参考以下文章