#删除邮件:收件人:test01 发件人:ff@x.com 主题:,接收时间:
Search-Mailbox -Identity "test01" -SearchQuery 'From:"ff@x.com"','主题:"转发:关于推荐年第二季度优秀员工评选的通知"',"Received:08/03/2015..08/03/2015" -DeleteContent -Force
#将邮件发送到名为receiver的邮箱的 收件箱 文件夹中
Search-Mailbox -Identity "test01" -SearchQuery 'From:"HR@xin.com"','主题:"【AA通知】2015Q3工作启动通知"',"Received:09/25/2015..09/25/2015" -TargetMailbox "receiver" -TargetFolder "收件箱"
在exchange powershell下运行:
search-mailbox -identity li -SearchQuery 'subject:"*密码*"',"Received:06/13/2016..06/13/2016" -TargetMailbox "liuy@x.com" -TargetFolder "收件箱" #查找主题包含 密码 关键字的邮件并发送到liuy@x.com
search-mailbox -identity li -SearchQuery 'body:"*检测*"',"Received:06/10/2016..06/13/2016" -TargetMailbox "liuy@x.com" -TargetFolder "收件箱" #查找正文包含 密码 关键字的邮件并发送到liuy@x.com
例搜索 April Stewart 的邮箱中主题包含“Your bank statement”短语的邮件,并将结果记录在管理员邮箱的 SearchAndDeleteLog 文件夹中。邮件将不复制到目标邮箱。
Search-Mailbox -Identity "April Stewart" -SearchQuery 'Subject:"Your bank statement"' -TargetMailbox "administrator" -TargetFolder "SearchAndDeleteLog" -LogOnly -LogLevel Full
删除包含有a,b,c关键字的邮件(OR必须大写,同时还会搜索附件中包含有该关键字的邮件):
search-mailbox -identity ww -SearchQuery 'a OR b OR c',"Received:01/01/2015..06/13/2016" -TargetMailbox "msearch@xin.com" -TargetFolder "收件箱"
https://technet.microsoft.com/zh-cn/library/dd298173.aspx Search-Mailbox命令参考
https://technet.microsoft.com/zh-cn/library/jj983804(v=exchg.150).aspx 搜索属性
https://technet.microsoft.com/zh-cn/library/dn774955(v=exchg.150).aspx 搜索运算符
============
下面还有点问题:
$user='li'
get-mailbox $user |New-MailboxSearch -Name $user -StartDate "6/13/2016" -EndDate "6/13/2016"-TargetMailbox "liuy@x.com" -SearchQuery 'Subject:"*开通*"' -MessageTypes Email -IncludeUnsearchableItems -LogLevel Full #新建查询任务
Get-MailboxSearch $user |Start-MailboxSearch #开始查找任务
Get-MailboxSearch $user |select Status,PercentComplete,ResultNumber,ResultSize,ResultSizeCopied #查看任务状态(较慢)
Get-MailboxSearch $user|Remove-MailboxSearch -confirm:$false #删除查询任务