Remove Emails from Recoverable Items (Purges & Deletions) in Exchange Online & On-Premises PowerShell

✨ Important 2026 Update — Purging Recoverable Items (Deletions & Purges)
  • Exchange Online (Use Purview PowerShell): Basic Auth EWS (WebCredentials) is permanently retired in Exchange Online. Use Connect-IPPSSession + New-ComplianceSearchAction -Purge -PurgeType HardDelete instead.
  • Retention / Hold Blocker: If a mailbox is under Litigation Hold or a Purview Retention Policy, items cannot be permanently purged until the hold is temporarily removed or excluded.
  • On-Premises Exchange Only: The EWS Managed API Folder.Empty(HardDelete) script below remains valid for on-premises Exchange Server 2016/2019/SE.

Sometimes administrators need to permanently remove sensitive or misdirected emails from a mailbox's hidden Recoverable Items folders (Deletions and Purges), which users cannot see or empty from Outlook.

Under RecoverableItemsRoot, Exchange maintains five hidden subfolders:

  • Audits
  • Calendar Logging
  • Deletions
  • Purges
  • Versions

Modern Method (Exchange Online): New-ComplianceSearchAction -PurgeType HardDelete

In Exchange Online (Microsoft 365), Basic Auth EWS is retired and EWS itself is being deprecated. Use Microsoft Purview Security & Compliance PowerShell (Connect-IPPSSession) with the Search And Purge role assigned:

POWERSHELL
Connect-IPPSSession -UserPrincipalName admin@lab365.in

$SearchName = "Purge-Recoverable-Cleanup"
New-ComplianceSearch -Name $SearchName `
    -ExchangeLocation "[email protected]" `
    -ContentMatchQuery 'Subject:"Confidential Payroll"'

Start-ComplianceSearch -Identity $SearchName

# Wait until Status is Completed, then HardDelete (moves items to Purges / permanent removal)
New-ComplianceSearchAction -SearchName $SearchName -Purge -PurgeType HardDelete -Confirm:$false

For full bulk-purge workflows across all mailboxes, see our Search & Purge Emails Across All M365 Mailboxes Runbook.


Legacy On-Premises Method: Empty Deletions & Purges via EWS Managed API 2.2

For on-premises Exchange Server (using Application Impersonation and EWS Managed API 2.2), you can empty Deletions or Purges directly:

POWERSHELL
param (
    [Parameter(Mandatory = $true)][string]$Mailbox,
    [switch]$Deletions,
    [switch]$Purges,
    [Parameter(Mandatory = $true)][string]$Admin,
    [Parameter(Mandatory = $true)][string]$Password,
    [string]$EwsUrl = "https://mail.corp.local/ews/exchange.asmx"
)

$DllPath = "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"
Import-Module $DllPath

$Service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1)
$Service.Credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials($Admin, $Password)
$Service.Url = [System.URI]$EwsUrl
$Service.ImpersonatedUserId = New-Object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SMTPAddress, $Mailbox)

$RootId = New-Object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::RecoverableItemsRoot, $Mailbox)
$RootFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($Service, $RootId)

$View = New-Object Microsoft.Exchange.WebServices.Data.FolderView(100)
$View.Traversal = [Microsoft.Exchange.WebServices.Data.FolderTraversal]::Deep
$Folders = $RootFolder.FindFolders($View)

if ($Deletions) {
    $Target = $Folders | Where-Object { $_.DisplayName -eq "Deletions" }
    Write-Host "Emptying Deletions ($($Target.TotalCount) items)..." -ForegroundColor Yellow
    $Target.Empty([Microsoft.Exchange.WebServices.Data.DeleteMode]::HardDelete, $true)
}

if ($Purges) {
    $Target = $Folders | Where-Object { $_.DisplayName -eq "Purges" }
    Write-Host "Emptying Purges ($($Target.TotalCount) items)..." -ForegroundColor Yellow
    $Target.Empty([Microsoft.Exchange.WebServices.Data.DeleteMode]::HardDelete, $true)
}

References & Official Microsoft Documentation

💬 Reader Comments & Feedback

Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.