Commands › Exchange Online

New-ComplianceSearchAction

Exchange Online ExchangeOnlineManagement New-*

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)

ParameterTypeRequiredWhat it controls
-SearchName String[] yes The SearchName parameter specifies the name of the existing content search to associate with the content search action. You can specify multiple content searches separated by commas.
-ActionName String This parameter is available only in the cloud-based service.
-ArchiveFormat ComplianceExportArchiveFormat This parameter is deprecated and no longer used.
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-EnableDedupe Boolean This parameter is available only in the cloud-based service.
-ExchangeArchiveFormat ComplianceExportArchiveFormat **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-Export SwitchParameter **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-FileTypeExclusionsForUnindexedItems String[] **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-Force SwitchParameter The Force switch hides warning or confirmation messages. You don't need to specify a value with this switch.
-Format ComplianceDataTransferFormat In Security & Compliance PowerShell, this parameter requires the Export role. By default, this role is assigned only to the eDiscovery Manager role group.
-IncludeCredential SwitchParameter The IncludeCredential switch specifies whether to include the credential in the results. You don't need to specify a value with this switch.
-IncludeSharePointDocumentVersions Boolean **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-JobOptions Int32 This parameter is reserved for internal Microsoft use.
-NotifyEmail String **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-NotifyEmailCC String **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-Preview SwitchParameter **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-Purge SwitchParameter **Note**: In Security & Compliance PowerShell, this switch is available only in the Search and Purge role. By default, this role is assigned only to the Organization Management and Data Investigator role groups.
-PurgeType ComplianceDestroyType **Note**: In Security & Compliance PowerShell, this parameter is available only in the Search and Purge role. By default, this role is assigned only to the Organization Management and Data Investigator role groups.
-ReferenceActionName String This parameter is reserved for internal Microsoft use.
-Region String This parameter is reserved for internal Microsoft use.
-Report SwitchParameter **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-RetentionReport SwitchParameter **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-RetryOnError SwitchParameter The RetryOnError switch specifies whether to retry the action on any items that failed without re-running the entire action all over again. You don't need to specify a value with this switch.
-Scenario ComplianceSearchActionScenario In Security & Compliance PowerShell, this parameter requires the Preview role. By default, this role is assigned only to the eDiscovery Manager role group.
-Scope ComplianceExportScope **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-SearchNames String[] This parameter is available only in the cloud-based service.
-SharePointArchiveFormat ComplianceExportArchiveFormat **Note**: This parameter is functional only in on-premises Exchange. For more information, see [May 2025 changes to Microsoft Purview...
-ShareRootPath String This parameter is available only in on-premises Exchange.
-Version String This parameter is reserved for internal Microsoft use.
-WhatIf SwitchParameter The WhatIf switch doesn't work in Security & Compliance PowerShell.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.