Commands › Exchange Online

Get-MailboxLocation

Exchange Online ExchangeOnlineManagement Get-*

View mailbox location information in Exchange Online.

Quick start script

# Get-MailboxLocation — 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
Get-MailboxLocation -Database <DatabaseIdParameter> -Identity <MailboxLocationIdParameter> -User <UserIdParameter> | Format-List

# 3. Export for evidence / drift tracking
Get-MailboxLocation | Export-Clixml .\MailboxLocation-$(Get-Date -Format yyyyMMdd).xml

Syntax — 3 parameter sets

DatabaseSet

Get-MailboxLocation -Database <DatabaseIdParameter>
 [-Confirm]
 [-MailboxLocationType <MailboxLocationType>]
 [-ResultSize <Unlimited>]
 [-WhatIf]
 [<CommonParameters>]

Identity

Get-MailboxLocation -Identity <MailboxLocationIdParameter>
 [-Confirm]
 [-MailboxLocationType <MailboxLocationType>]
 [-ResultSize <Unlimited>]
 [-WhatIf]
 [<CommonParameters>]

User

Get-MailboxLocation -User <UserIdParameter>
 [-IncludePreviousPrimary]
 [-Confirm]
 [-MailboxLocationType <MailboxLocationType>]
 [-ResultSize <Unlimited>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (8)

ParameterTypeRequiredWhat it controls
-Database DatabaseIdParameter yes This parameter is available only in on-premises Exchange.
-Identity MailboxLocationIdParameter yes The Identity parameter specifies the mailbox location object that you want to view. The value uses the either of the following formats:
-User UserIdParameter yes This parameter is available only in the cloud-based service.
-Confirm SwitchParameter This parameter is reserved for internal Microsoft use.
-IncludePreviousPrimary SwitchParameter This parameter is available only in the cloud-based service.
-MailboxLocationType MailboxLocationType The MailboxLocationType filters the results by the type of mailbox. Valid values are:
-ResultSize Unlimited The ResultSize parameter specifies the maximum number of results to return. If you want to return all requests that match the query, use unlimited for the value of this parameter. The default value is 1000.
-WhatIf SwitchParameter This parameter is reserved for internal Microsoft use.

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