Commands › Exchange Online
New-ComplianceSearchAction
Create actions for content searches in Exchange Server and in Microsoft Purview. **Note**: Several of the parameters on this cmdlet are functional only in on-premises Exchange. For more information, see May 2025 changes to Microsoft Purview eDiscovery.
Quick start script
# New-ComplianceSearchAction — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org
# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-ComplianceSearchAction
$before | Format-List
# 3. Make the change (dry run first)
New-ComplianceSearchAction -SearchName <String[]> -WhatIf
New-ComplianceSearchAction -SearchName <String[]>
# 4. Verify and diff
$after = Get-ComplianceSearchAction
Compare-Object ($before | Out-String) ($after | Out-String)
Syntax — 3 parameter sets
Export
New-ComplianceSearchAction [-SearchName] <String[]> [-Export]
[-ActionName <String>]
[-ArchiveFormat <ComplianceExportArchiveFormat>]
[-Confirm]
[-FileTypeExclusionsForUnindexedItems <String[]>]
[-EnableDedupe <Boolean>]
[-ExchangeArchiveFormat <ComplianceExportArchiveFormat>]
[-Force]
[-Format <ComplianceDataTransferFormat>]
[-IncludeCredential]
[-IncludeSharePointDocumentVersions <Boolean>]
[-JobOptions <Int32>]
[-NotifyEmail <String>]
[-NotifyEmailCC <String>]
[-ReferenceActionName <String>]
[-Region <String>]
[-Report]
[-RetentionReport]
[-RetryOnError]
[-Scenario <ComplianceSearchActionScenario>]
[-Scope <ComplianceExportScope>]
[-SearchNames <String[]>]
[-SharePointArchiveFormat <ComplianceExportArchiveFormat>]
[-ShareRootPath <String>]
[-Version <String>]
[-WhatIf]
[<CommonParameters>]
Preview
New-ComplianceSearchAction [-SearchName] <String[]> [-Preview]
[-ActionName <String>]
[-Confirm]
[-Force]
[-Format <ComplianceDataTransferFormat>]
[-IncludeCredential]
[-JobOptions <Int32>]
[-ReferenceActionName <String>]
[-Region <String>]
[-RetryOnError]
[-Scenario <ComplianceSearchActionScenario>]
[-SearchNames <String[]>]
[-Version <String>]
[-WhatIf]
[<CommonParameters>]
Purge
New-ComplianceSearchAction [-SearchName] <String[]> [-Purge]
[-PurgeType <ComplianceDestroyType>]
[-ActionName <String>]
[-Confirm]
[-Force]
[-Format <ComplianceDataTransferFormat>]
[-IncludeCredential]
[-JobOptions <Int32>]
[-Region <String>]
[-ReferenceActionName <String>]
[-RetryOnError]
[-Scenario <ComplianceSearchActionScenario>]
[-SearchNames <String[]>]
[-Version <String>]
[-WhatIf]
[<CommonParameters>]
Parameters (30)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.