search and delete
отсюда https://winitpro.ru/index.php/2018/07/20/search-mailbox-poisk-i-udalenie-otdelnyx-pisem-iz-yashhikov-exchange/
New-ComplianceSearch -Name FastSearch2 -ExchangeLocation all -ContentMatchQuery 'from:"hti***ssia@icloud.com" OR to:"hti***sia@icloud.com"'
Start-ComplianceSearch -Identity FastSearch2
________________________________________________________ .\123.ps1
$search = Get-ComplianceSearch -Identity FastSearch2
$results = $search.SuccessResults
$mbxs = @()
$lines = $results -split '[\r\n]+'
foreach ($line in $lines)
{
if ($line -match 'Location: (\S+),.+Item count: (\d+)' -and $matches[2] -gt 0)
{
$mbxs += $matches[1]
}
}
$results | Out-File "F:\Group_Control\result.txt"
$results |
Get-Mailbox
| Search-Mailbox
-SearchQuery
'from:"@corp.com"'
-DeleteContent
-Force
ИТОГ
PS] F:\PS>Get-Mailbox -Database DB2-V10 | Search-Mailbox -SearchQuery 'from:"********@icloud.com" OR to:"********@icloud.com"' -DeleteContent -Force | Out-File "F:\Group_Control\result1.txt"
Комментарии
Отправить комментарий