Search-Mailbox
Search a mailbox and copy the results to a specified target mailbox, delete messages from the source mailbox, or both. **Note**: In cloud-based environments, the Search-Mailbox cmdlet was deprecated in favor of New-ComplianceSearch and related eDiscovery cmdlets. By default, Search-Mailbox is available only in the Mailbox Search or Mailbox Import Export roles, and these roles aren't assigned to *any* role groups. To use this cmdlet, you need to add one or both of the roles to a role group (for example, the Organization Management role group). Only the Mailbox Import Export role gives you acces
Quick start script
# Search-Mailbox — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org
# 2. Run and inspect
Search-Mailbox -Identity <MailboxOrMailUserIdParameter> -EstimateResultOnly <SwitchParameter> -TargetFolder <String> | Format-List
# 3. Export for evidence / drift tracking
Search-Mailbox | Export-Clixml .\Mailbox-$(Get-Date -Format yyyyMMdd).xml
Syntax — 3 parameter sets
Identity
Search-Mailbox [-Identity] <MailboxOrMailUserIdParameter>
[-Confirm]
[-DeleteContent]
[-DomainController <Fqdn>]
[-DoNotIncludeArchive]
[-Force]
[-IncludeUnsearchableItems]
[-SearchDumpster]
[-SearchDumpsterOnly]
[-SearchQuery <String>]
[-WhatIf]
[<CommonParameters>]
EstimateResult
Search-Mailbox [-Identity] <MailboxOrMailUserIdParameter>
[-EstimateResultOnly]
[-Confirm]
[-DomainController <Fqdn>]
[-DoNotIncludeArchive]
[-Force]
[-IncludeUnsearchableItems]
[-SearchDumpster]
[-SearchDumpsterOnly]
[-SearchQuery <String>]
[-WhatIf]
[<CommonParameters>]
Mailbox
Search-Mailbox [-Identity] <MailboxOrMailUserIdParameter> -TargetFolder <String> -TargetMailbox <MailboxIdParameter>
[-Confirm]
[-DeleteContent]
[-DomainController <Fqdn>]
[-DoNotIncludeArchive]
[-Force]
[-IncludeUnsearchableItems]
[-LogLevel <LoggingLevel>]
[-LogOnly]
[-SearchDumpster]
[-SearchDumpsterOnly]
[-SearchQuery <String>]
[-WhatIf]
[<CommonParameters>]
Parameters (16)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.