Get-MailboxLocation
This cmdlet is available in on-premises Exchange and in the cloud-based service. Some parameters and settings may be exclusive to one environment or the other.
Use the Get-MailboxLocation cmdlet to view mailbox location information in Exchange Online.
For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.
Syntax
Get-MailboxLocation
-Database <DatabaseIdParameter>
[-Confirm]
[-MailboxLocationType <MailboxLocationType>]
[-ResultSize <Unlimited>]
[-WhatIf]
[<CommonParameters>]
Get-MailboxLocation
-Identity <MailboxLocationIdParameter>
[-Confirm]
[-MailboxLocationType <MailboxLocationType>]
[-ResultSize <Unlimited>]
[-WhatIf]
[<CommonParameters>]
Get-MailboxLocation
-User <UserIdParameter>
[-IncludePreviousPrimary]
[-Confirm]
[-MailboxLocationType <MailboxLocationType>]
[-ResultSize <Unlimited>]
[-WhatIf]
[<CommonParameters>]
Description
You need to be assigned permissions before you can run this cmdlet. Although this topic lists all parameters for the cmdlet, you may not have access to some parameters if they're not included in the permissions assigned to you. To find the permissions required to run any cmdlet or parameter in your organization, see Find the permissions required to run any Exchange cmdlet.
Examples
Example 1
Get-MailboxLocation -User [email protected]
In Exchange Online, this example returns the mailbox location information for the user [email protected].
Example 2
Get-MailboxLocation -Identity e15664af-82ed-4635-b02a-df7c2e03d950
In Exchange Server or Exchange Online, this example returns the mailbox location information for the specified mailbox GUID (the ExchangeGuid property value from the results of Get-Mailbox -Identity <MailboxIdentity> | Format-List ExchangeGuid
).
Parameters
-Confirm
The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on if the cmdlet requires confirmation before proceeding.
- Destructive cmdlets (for example, Remove-* cmdlets) have a built-in pause that forces you to acknowledge the command before proceeding. For these cmdlets, you can skip the confirmation prompt by using this exact syntax:
-Confirm:$false
. - Most other cmdlets (for example, New-* and Set-* cmdlets) don't have a built-in pause. For these cmdlets, specifying the Confirm switch without a value introduces a pause that forces you acknowledge the command before proceeding.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | Exchange Server 2016, Exchange Server 2019, Exchange Online |
-Database
This parameter is available only in on-premises Exchange.
The Database parameter returns the mailbox location information for all mailboxes on the specified mailbox database. You can use any value that uniquely identifies the database. For example:
- Name
- Distinguished name (DN)
- GUID
You can't use this parameter with the Identity parameter.
Type: | DatabaseIdParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | Exchange Server 2016, Exchange Server 2019 |
-Identity
The Identity parameter specifies the mailbox location object that you want to view. The value uses the either of the following formats:
- TenantGUID\MailboxGUID
- MailboxGUID
In Exchange Server or Exchange Online, you can run the following command to find and compare the MailboxGUID values for the user: Get-Mailbox -Identity <MailboxIdentity> | Format-List *GUID,MailboxLocations
.
In Exchange Online, you can find the TenantGUID and MailboxGUID values after you run Get-MailboxLocation with the User parameter.
You can't use this parameter with the User parameter.
Type: | MailboxLocationIdParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | Exchange Server 2016, Exchange Server 2019, Exchange Online |
-IncludePreviousPrimary
This parameter is available only in the cloud-based service.
The IncludePreviousPrimary switch specifies whether to include the previous primary mailbox in the results. You don't need to specify a value with this switch.
You can only use this switch with the User parameter.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | Exchange Online |
-MailboxLocationType
The MailboxLocationType filters the results by the type of mailbox. Valid values are:
- Aggregated
- AuxArchive
- AuxPrimary
- ComponentShared
- MainArchive
- PreviousPrimary (Exchange Online only)
- Primary
Type: | MailboxLocationType |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | Exchange Server 2016, Exchange Server 2019, Exchange Online |
-ResultSize
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.
Type: | Unlimited |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | Exchange Server 2016, Exchange Server 2019, Exchange Online |
-User
This parameter is available only in the cloud-based service.
The User parameter specifies the user whose mailbox location you want to view. You can use any value that uniquely identifies the user. For example:
- Name
- Distinguished name (DN)
- Canonical DN
- GUID
You can't use this parameter with the Identity parameter.
Type: | UserIdParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Applies to: | Exchange Online |
-WhatIf
The WhatIf switch simulates the actions of the command. You can use this switch to view the changes that would occur without actually applying those changes. You don't need to specify a value with this switch.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Applies to: | Exchange Server 2016, Exchange Server 2019, Exchange Online |