有时候员工会误发送邮件,需要使用此命名去删除
给管理组赋权
New-ManagementRoleAssignment –Role “Mailbox Import Export” –User ixmsoft\administrator
OR
Get-Mailbox -ResultSize Unlimited | Add-MailboxPermission -User "wu" -Acce***ights Fullaccess -InheritanceType All

删除邮件之前先保存他的邮件到特定账户
Search-Mailbox -Identity "xiayu" -SearchQuery "Subject:15" -TargetMailbox "xiatian" -TargetFolder "beifen" -LogLevel Full

删除特定时间,特定用户的邮件
Search-Mailbox -Identity xiayu -SearchQuery "Received:01/22/2018..01/22/2018" -DeleteContent

删除特定主题,特定用户的邮件
Search-Mailbox -Identity xiayu -SearchQuery Subject:'15' –DeleteContent

批量删除用户邮件之前,先保存用户邮件
Import-Csv -Path 'C:\list\long.csv' | Foreach {Search-Mailbox -SearchQuery '主题:"26"' -Identity $_.Email -TargetMailbox [email protected] -TargetFolder inbox}

批量删除用户邮件
Import-Csv -Path 'C:\long.csv' | Foreach {Search-Mailbox -SearchQuery Subject:'36' -DeleteContent -Identity $_.Email}

删除所有用户,特定主题的邮件
Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery "subject:35" -DeleteContent