Commands › Exchange Online

Set-MailboxSearch

Exchange Online ExchangeOnlineManagement Set-*

Modify an existing mailbox search. **Note**: As of October 2020, the \*-MailboxSearch cmdlets are retired in Exchange Online PowerShell. Use the \*-ComplianceSearch cmdlets in Security & Compliance PowerShell instead. For more information, see Retirement of legacy eDiscovery tools.

Quick start script

# Set-MailboxSearch — 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-MailboxSearch
$before | Format-List

# 3. Make the change (dry run first)
Set-MailboxSearch -Identity <SearchObjectIdParameter> -WhatIf
Set-MailboxSearch -Identity <SearchObjectIdParameter>

# 4. Verify and diff
$after = Get-MailboxSearch
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

Set-MailboxSearch [-Identity] <SearchObjectIdParameter>
 [-AllPublicFolderSources <Boolean>]
 [-AllSourceMailboxes <Boolean>]
 [-Confirm]
 [-Description <String>]
 [-DomainController <Fqdn>]
 [-DoNotIncludeArchive]
 [-EndDate <ExDateTime>]
 [-EstimateOnly]
 [-ExcludeDuplicateMessages <Boolean>]
 [-Force]
 [-IncludeKeywordStatistics]
 [-IncludeUnsearchableItems <Boolean>]
 [-InPlaceHoldEnabled <Boolean>]
 [-ItemHoldPeriod <Unlimited>]
 [-Language <CultureInfo>]
 [-LogLevel <LoggingLevel>]
 [-MessageTypes <KindKeyword[]>]
 [-Name <String>]
 [-Recipients <String[]>]
 [-SearchDumpster <Boolean>]
 [-SearchQuery <String>]
 [-Senders <String[]>]
 [-SourceMailboxes <RecipientIdParameter[]>]
 [-StartDate <ExDateTime>]
 [-StatisticsStartIndex <Int32>]
 [-StatusMailRecipients <RecipientIdParameter[]>]
 [-TargetMailbox <MailboxIdParameter>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (29)

ParameterTypeRequiredWhat it controls
-Identity SearchObjectIdParameter yes The Identity parameter specifies the name of the mailbox search that you want to modify. If the value contains spaces, enclose the value in quotation marks (").
-AllPublicFolderSources Boolean The AllPublicFolderSources parameter specifies whether to include all public folders in the organization in the search. Valid values are:
-AllSourceMailboxes Boolean The AllSourceMailboxes parameter specifies whether to include all mailboxes in the search. Valid values are:
-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.
-Description String The Description parameter specifies a description for the search. If the value contains spaces, enclose the value in quotation marks (").
-DomainController Fqdn This parameter is available only in on-premises Exchange.
-DoNotIncludeArchive SwitchParameter The DoNotIncludeArchive switch excludes items in the user's Archive mailbox from mailbox searches. You don't need to specify a value with this switch.
-EndDate ExDateTime The EndDate parameter specifies the end date of the date range.
-EstimateOnly SwitchParameter The EstimateOnly switch provides only an estimate of the number of items that will be returned without copying message to the target mailbox. You don't need to specify a value with this switch.
-ExcludeDuplicateMessages Boolean The ExcludeDuplicateMessages parameter eliminates duplication of messages across mailboxes in an In-Place eDiscovery search. Valid values are:
-Force SwitchParameter The Force switch hides warning or confirmation messages. You don't need to specify a value with this switch.
-IncludeKeywordStatistics SwitchParameter The IncludeKeywordStatistics switch returns keyword statistics (number of instances for each keyword). You don't need to specify a value with this switch.
-IncludeUnsearchableItems Boolean The IncludeUnsearchableItems parameter specifies whether items that couldn't be indexed by Exchange Search should be included in the results. Valid values are:
-InPlaceHoldEnabled Boolean The InPlaceHoldEnabled parameter specifies whether to set an In-Place Hold on items in the search results. Valid values are:
-ItemHoldPeriod Unlimited The ItemHoldPeriod parameter specifies the number of days for the In-Place Hold onthe mailbox items (all items or the mailbox items that are returned in the search query results). You use this parameter with the...
-Language CultureInfo The Language parameter specifies a locale for the mailbox search.
-LogLevel LoggingLevel The LogLevel parameter specifies a logging level for the mailbox search. Valid values are:
-MessageTypes KindKeyword[] The MessageTypes parameter specifies the message types to include in the search query. Valid values are:
-Name String The Name parameter specifies a name for the search. If the value contains spaces, enclose the value in quotation marks (").
-Recipients String[] The Recipients parameter specifies one or more recipients include in the search query. Messages that have the specified recipients in the To, Cc, and Bcc fields are returned in the search results.
-SearchDumpster Boolean The SearchDumpster parameter specifies whether the dumpster is searched. The dumpster is a storage area in the mailbox where deleted items are temporarily stored after being deleted or removed from the Deleted Items...
-SearchQuery String The SearchQuery parameter specifies keywords for the search query by using the Keyword Query Language (KQL). For more information, see [Keyword Query Language (KQL) syntax...
-Senders String[] The Senders parameter specifies one or more senders to include in the search query. Messages that have the specified sender are returned in the search results. Senders can include users, distribution groups (messages...
-SourceMailboxes RecipientIdParameter[] The SourceMailboxes parameter specifies the mailboxes to be searched. You can use any value that uniquely identifies the mailbox. For example:
-StartDate ExDateTime The StartDate parameter specifies the start date of the date range.
-StatisticsStartIndex Int32 The StatisticsStartIndex parameter is used by the Exchange admin center (EAC) to retrieve keyword statistics in a paged operation.
-StatusMailRecipients RecipientIdParameter[] The StatusMailRecipients parameter specifies one or more recipients to receive a status email message upon completion of the search. You can use any value that uniquely identifies the recipient. For example:
-TargetMailbox MailboxIdParameter The TargetMailbox parameter specifies the destination mailbox where the search results are copied. You can use any value that uniquely identifies the mailbox. For example:
-WhatIf SwitchParameter The WhatIf switch shows what the command does without making any changes. You don't need to specify a value with this switch.

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