Office365 O365合规性搜索硬删除不工作
用户删除的邮件中有超过40GB的电子邮件。她已经证实,她不需要它们来恢复 我已经使用这里概述的方法运行了一个搜索来提取她的“已删除邮件”文件夹id 然后,在2020年3月30日之前,我在合规中心为她的用户创建了一个搜索,以文件夹id作为搜索词进行搜索。搜索返回20 GB以上的结果 我使用connect IPPSession通过2fa连接到法规遵从性服务 并运行以下命令 新合规性搜索行动-搜索名称“2020年3月30日之前删除的项目”-清除-PurgeType硬删除 动作立即完成显示 结果:吹扫类型:硬删除;项目计数:0;总尺寸0;详细信息:{} 用户邮箱的大小根本没有缩小,所有已删除的邮件仍然存在。再次运行搜索将返回相同的20+GB结果 我尝试了软删除和硬删除选项,结果是一样的,什么都没有发生Office365 O365合规性搜索硬删除不工作,office365,o365security-compliance,Office365,O365security Compliance,用户删除的邮件中有超过40GB的电子邮件。她已经证实,她不需要它们来恢复 我已经使用这里概述的方法运行了一个搜索来提取她的“已删除邮件”文件夹id 然后,在2020年3月30日之前,我在合规中心为她的用户创建了一个搜索,以文件夹id作为搜索词进行搜索。搜索返回20 GB以上的结果 我使用connect IPPSession通过2fa连接到法规遵从性服务 并运行以下命令 新合规性搜索行动-搜索名称“2020年3月30日之前删除的项目”-清除-PurgeType硬删除 动作立即完成显示 结果:吹扫
我已通过Get ComplianceSearch确认,powershell中显示的搜索名称的数据估计为20GB,那么为什么HardDelete没有删除任何内容?因此我了解到清除操作一次只能删除10个项目。至于为什么你和我没有看到任何电子邮件被删除,我从来没有完全弄清楚。我怀疑每次运行都会删除10个邮箱,但由于我搜索了多个邮箱(根据我的要求),结果不清楚。从那以后,我成功地使用了一个脚本(如下所示),我根据自己的需求对该脚本进行了调整 非常感谢Tony Redmond,我修改了他的剧本
Clear-Host
# Connect to Exchange Online
$credentials = get-credential;
Connect-ExchangeOnline -Credential $credentials
$SccSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $credentials -Authentication "Basic" -AllowRedirection;
Import-PSSession $SccSession
$mailboxes = @("mailbox1@example.net", "mailbox2@example.net")
$monthsToKeep = 3
$sourceDate = (Get-Date).AddMonths(-$monthsToKeep)
$searchName = "PurgeEmails"
$contentQuery = "received<=$($sourcDeate) AND kind:email"
# Clean-up any old searches from failed runs of this script
if (Get-ComplianceSearch -Identity $searchName) {
Write-Host "Cleaning up any old searches from failed runs of this script"
try {
Remove-ComplianceSearch -Identity $searchName -Confirm:$false | Out-Null
}
catch {
Write-Host "Clean-up of old script runs failed!" -ForegroundColor Red
break
}
}
Write-Host "Creating new search for emails older than $($sourceate)"
New-ComplianceSearch -Name $searchName -ContentMatchQuery $contentQuery -ExchangeLocation $mailboxes -AllowNotFoundExchangeLocationsEnabled $true | Out-Null
Start-ComplianceSearch -Identity $searchName | Out-Null
Write-Host "Searching..."
while ((Get-ComplianceSearch -Identity $searchName).Status -ne "Completed") {
Write-Host "." -NoNewline
Start-Sleep -Seconds 2
}
$items = (Get-ComplianceSearch -Identity $searchName).Items
if ($items -gt 0) {
$searchStatistics = Get-ComplianceSearch -Identity $searchName | Select-Object -Expand SearchStatistics | Convertfrom-JSON
$sources = $searchStatistics.ExchangeBinding.Sources | Where-Object { $_.ContentItems -gt 0 }
Write-Host ""
Write-Host "Total Items found matching query:" $items
Write-Host ""
Write-Host "Items found in the following mailboxes"
Write-Host "--------------------------------------"
foreach ($source in $sources) {
Write-Host $source.Name "has" $source.ContentItems "items of size" $source.ContentSize
}
Write-Host ""
$iterations = 0;
$itemsProcessed = 0
while ($itemsProcessed -lt $items) {
$iterations++
Write-Host "Deleting items iteration $($iterations)"
New-ComplianceSearchAction -SearchName $searchName -Purge -PurgeType HardDelete -Confirm:$false | Out-Null
while ((Get-ComplianceSearchAction -Identity "$($searchName)_Purge").Status -ne "Completed") {
Start-Sleep -Seconds 2
}
$itemsProcessed = $itemsProcessed + 10
# Remove the search action so we can recreate it
Remove-ComplianceSearchAction -Identity "$($searchName)_Purge" -Confirm:$false
}
} else {
Write-Host "No items found"
}
Write-Host ""
Write-Host "COMPLETED!"
清除主机
#连接到Exchange Online
$credentials=获取凭证;
连接ExchangeOnline-凭据$凭据
$SccSession=New PSSession-ConfigurationName Microsoft.Exchange-ConnectionUrihttps://ps.compliance.protection.outlook.com/powershell-liveid/ -凭证$credentials-身份验证“基本”-AllowerDirection;
导入会话$SccSession
$mailboxes=@(“mailbox1@example.net", "mailbox2@example.net")
$monthsToKeep=3
$sourceDate=(获取日期).AddMonths(-$monthsToKeep)
$searchName=“PurgeEmails”
$contentQuery=“receivedHaving相同的问题,如果我找到解决方案,将发布一个答案!我最终找到了一些有效的方法,并按照承诺将其发布为下面的答案。我仍在修改脚本,这只是我最初使用的版本。希望它对您有所帮助!