总有些时候,会有一些人群发邮件错误,需要管理员后台删除,没有想到office365后台升级,原来的方法不好用了,需要使用新方案:
以管理员身份打开powershell
1. 安装 EXO V2 模块
https://www.powershellgallery.com/packages/ExchangeOnlineManagement/2.0.5
Install-Module -Name ExchangeOnlineManagement -RequiredVersion 2.0.5
2.建立连接,输入管理员密码
Connect-IPPSSession -UserPrincipalName admin@yourdomain.com
3.创建查询结果,命名为“reportname",这个名字可以任意起,只要不和以前的重复就可以。
$Search=New-ComplianceSearch -Name "reportname" -ExchangeLocation All -ContentMatchQuery ' (Received:3/23/2022..3/25/2022) AND (Subject:"Re: keyword")'
Start-ComplianceSearch -Identity $Search.Identity
4.验证:运行完成后进入到office365管理中心的安全和合规管理---查询,复合一下查询的结果是不是你要删除的内容
5.powershell删除,有软删除和硬删除,自行选中执行命令
New-ComplianceSearchAction -SearchName "reportname" -Purge -PurgeType SoftDelete
New-ComplianceSearchAction -SearchName "reportname" -Purge -PurgeType HardDelete
Confirm
Are you sure you want to perform this action?
此操作将导致用户完全无法访问满足合规性搜索“reportname”的标准的邮件项目。没有自动方法可撤消删除这些邮件项目。
[Y] Yes [A] Yes to All [N] No [L] No to All [?] 帮助 (默认值为“Y”): Y
01-17
920
06-08
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交