Pages

Tuesday, October 11, 2022

Search và xóa email trong Exchange online & On-premise

Cần xóa các email có nội dùng và gửi tới user:

'subject:"Reminder task work 02-12-2020" 
to:"test4@domainabc.vn"'


New-ComplianceSearch `
-Name TestSearch `
-ExchangeLocation All `
-ContentMatchQuery 'subject:"Reminder task work 02-12-2020'

New-ComplianceSearch -name "TestSearch4" -ExchangeLocation all -ContentMatchQuery 'subject:"Reminder task work 02-12-2020" and to:"test4@domainabc.vn"'

Start-ComplianceSearch -Identity TestSearch4

Get-ComplianceSearch -Identity TestSearch4 | Format-List *

New-ComplianceSearchAction -SearchName TestSearch4 -Preview

(Get-ComplianceSearchAction TestSearch4_Preview | Select-Object -ExpandProperty Results) -split ","

--- Remove Compliance Search nếu không dùng
Remove-ComplianceSearch -Identity TestSearch4


New-ComplianceSearch -Name "TestSearch4" -ExchangeLocation test4@domainabc.vn -ContentMatchQuery 'sent>=12/01/2020 AND sent<=12/03/2020 AND subject:"Reminder task work 02-12-2020"'


New-ComplianceSearch -Name "TestSearch4" -ExchangeLocation test4@domainabc.vn -ContentMatchQuery 'subject:"Reminder task work 02-12-2020"'

New-ComplianceSearch -Name "TestSearch4" -ExchangeLocation test4@domainabc.vn -ContentMatchQuery 'subject:"Reminder task work 02-12-2020"'

New-ComplianceSearchAction -SearchName "TestSearch4" -Purge -PurgeType SoftDelete

-- Exchange online
New-ComplianceSearchAction -SearchName "TestSearch4" -Purge -PurgeType HardDelete -Confirm:$False

-- Tham khao
https://docs.microsoft.com/en-us/microsoft-365/compliance/delete-items-in-the-recoverable-items-folder-of-mailboxes-on-hold?view=o365-worldwide

Run the following command to change the deleted item retention period back to its original value. This assumes that the previous setting is less than 30 days; for example, 14 days.
Set-Mailbox <username> -RetainDeletedItemsFor 14

----


Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'Subject:"Your query"' - EstimateResultOnly 


Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'from:"from:"l.tran@domainabc.com" AND to:"from:"p.le@domainabc.com"'


Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'from:"from:"unicore@domainabc.com" AND to:"from:"p.le@domainabc.com"'


Get-Mailbox -Server EXCH07 -ResultSize unlimited | Search-Mailbox -SearchQuery 'from:"l.tran@domainabc.com"'


-SearchQuery 'from:"from:"l.tran@domainabc.com" AND to:"from:"p.le@domainabc.com"'


New-ComplianceSearch -Name "RemoveSearch2" -ExchangeLocation all -ContentMatchQuery 'subject:"fff"'

(From:chatsuwloginsset12345@outlook.com) AND (Subject:"Update your account information")


Get-ComplianceSearch | FL name,items,size,jobprogress,status



Search-Mailbox -Identity 'Jane Johnson' -SearchQuery 'From:"Unicore" and attachment:.txt' -DeleteContent

Search-Mailbox -Identity test4 -SearchDumpsterOnly -SearchQuery {Received:"2020/3/12..2020/3/12"} -EstimateResultOnly
Search-Mailbox -Identity test4 -SearchDumpsterOnly -SearchQuery {Received:"2020/3/12..2020/3/12"} -DeleteContent

Get-Mailbox -Identity test4 -SearchDumpsterOnly -SearchQuery {Received:"2020/3/12..2020/3/12"}

No comments: