Email Purge

 

Steps for mail purge


STEP 1: CREATING THE CONTENT SEARCH RULE

1.      Head over to https://purview.microsoft.com/ediscovery

2.      Click Ediscovery => Content Search and click the plus icon to create a “Create a Search”.

3.      Give the search a name and a description if desired and click “Create

4.      Condition Builder – WHERE WE DEFINE WHAT EMAIL(S) WE WANT TO DELETE

5.      In the “Condition Builder” section click the “Add conditions” button (you may have to scroll down)

6.      Add the condition(s) relevant to what you are searching for. In my case emails which contain the sender “test@xyz.com” and that were received after a certain date.

 

Source SECTION – WE ONLY WANT TO SEARCH EXCHANGE

1.      Under the Source section select “Add tenant-wide sources”.

2.      Only enable the Mailboxes section.

 

3.      Click Save.

 

FINISHING THE RULE

a)     Click “Run Query”.

b)     At this point the search will run. It is very important you take a good look to confirm only the email(s) you want to delete are returned.

 

 

 

 

STEP 2: DELETING THE MATCHED EMAILS VIA POWERSHELL

 

1.      Connect to Powershell using command “Connect-IPPSSession

2.      Deleting the emails matching the content search rule

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

 

 

*Rule name will be the name that we have created during content search.

 

STEP 3: CHECKING THE STATUS

1.      Using the command below, you can get a summary of the status of the action.

Get-ComplianceSearchAction

 

2.      Or you can get a detailed output for the action using the below.

Get-ComplianceSearchAction -Identity "RuleName_Purge" | Format-List

 


Purge command --

New-ComplianceSearchAction -SearchName "Mail purge" -Purge -PurgeType SoftDelete


Check status ---

Get-ComplianceSearchAction -Identity "Mail purge"


No comments: