Clear previous Powershell sessions
Get-PSSession | Remove-PSSession; Disconnect-ExchangeOnline
Connect to PowershellExchange module
Connect-IPPSSession -UserPrincipalName globaladmin@emailaddress.com
Create a Compliance Search
New-ComplianceSearch -Name "Your Search Name" -Identity "YourTargetMailbox@email.com" -ExchangeLocation youraddress@email.com -ContentMatchQuery "Your Search Query"
Check the status of your search
Get-ComplianceSearch
Start a Compliance Search
Start-ComplianceSearch -Identity "Your Search Name"
View result of the search
Get-ComplianceSearch -Identity "Your Search Name" | Format-List
Permanently delete the content found in the search
New-ComplianceSearchAction -SearchName "Your Search Name" -Purge -PurgeType HardDelete
Delete the completed jobs
Get-ComplianceSearchAction | Remove-ComplianceSearchAction
Get-ComplianceSearch | Remove-ComplianceSearch
No responses yet