Office 365のセキュリティ&準拠センターを使用してComplianceSearchを実行し、ソフト削除を使用して問題のメールを削除しています。完了したら、同じ検索を実行して電子メールが削除されたことを確認しますが、検索クエリの結果と同じ数の結果が表示されます。これは、ソフト削除によって電子メールがリカバリ可能なアイテムフォルダに移動するためです。私の質問は、回復可能なアイテムフォルダを除外してNew-ComplianceSearch
を作成するにはどうすればいいですか?New-ComplianceSearchから回復可能なアイテムフォルダを除外します
更新 Matthewは以下の正しい方向に私を指摘しました。
# Collect the target email address
$addressOrSite = Read-Host "Enter an email address"
# Authenticate with Exchange Online and the Security & Complaince Center (Exchange Online Protection - EOP)
if (!$credentials)
{
$credentials = Get-Credential
}
if ($addressOrSite.IndexOf("@") -ige 0)
{
# List the folder Ids for the target mailbox
$emailAddress = $addressOrSite
# Authenticate with Exchange Online
if (!$ExoSession)
{
$ExoSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell-liveid/ -Credential $credentials -Authentication Basic -AllowRedirection
Import-PSSession $ExoSession -AllowClobber -DisableNameChecking
}
$folderQueries = @()
$folderStatistics = Get-MailboxFolderStatistics $emailAddress
foreach ($folderStatistic in $folderStatistics)
{
$folderId = $folderStatistic.FolderId;
$folderPath = $folderStatistic.FolderPath;
$encoding= [System.Text.Encoding]::GetEncoding("us-ascii")
$nibbler= $encoding.GetBytes("ABCDEF");
$folderIdBytes = [Convert]::FromBase64String($folderId);
$indexIdBytes = New-Object byte[] 48;
$indexIdIdx=0;
$folderIdBytes | select -skip 23 -First 24 | %{$indexIdBytes[$indexIdIdx++]=$nibbler[$_ -shr 4];$indexIdBytes[$indexIdIdx++]=$nibbler[$_ -band 0xF]}
$folderQuery = "folderid:$($encoding.GetString($indexIdBytes))";
$folderStat = New-Object PSObject
Add-Member -InputObject $folderStat -MemberType NoteProperty -Name FolderPath -Value $folderPath
Add-Member -InputObject $folderStat -MemberType NoteProperty -Name FolderQuery -Value $folderQuery
$folderQueries += $folderStat
}
Write-Host "-----Exchange Folders-----"
$folderQueries |ft
}
あなたは、あなたの検索からフォルダを削除するには、これらのFolderIDsを使用することができます(下記)あなたが指定したメールボックスの欠失は、回復可能なアイテム、およびパージフォルダのフォルダIDを取得することができますスクリプトhereを使用して。たとえば:
New-ComplianceSearch -Name test123 -ExchangeLocation [email protected] -ContentMatchQuery "subject:'some subject' AND NOT ((folderid:3F4BE1AEF6C6BB45B8F8EEFE472A7E5C0000000001130000) OR (folderid:3F4BE1AEF6C6BB45B8F8EEFE472A7E5C0000000001140000) OR (folderid:3F4BE1AEF6C6BB45B8F8EEFE472A7E5C0000000001160000))"
ありがとうございます。これは有望です。私はそれをすぐに見て、うまくいけば何かを考え出すだろうが、それはちょっとした作業がかかるように思える。不思議なことに、O365テナントのすべてのメールボックスから迷惑メールと悪意のある電子メールを削除するPowerShellスクリプトを作成しています。https://github.com/jdgregson/Delete-Emails-O365/blob/master/Delete-Emails .ps1。これまでのところ非常に効果的ですが、電子メールが削除済みアイテムフォルダに移動したことを確認できないという問題が1つあります。 – jdgregson