Skip to main content

Mailbox helpers

Requires an EXO session. For full and always-up-to-date details, use Get-Help <FunctionName> -Detailed.

Add-MboxAlias

Add SMTP aliases on a recipient.

Syntax

Add-MboxAlias -SourceMailbox <String> -MailboxAlias <String>
ParameterTypeDescriptionRequiredDefault
SourceMailbox (Identity)StringTarget mailbox/recipient. Pipeline accepted.Yes-
MailboxAliasStringAlias (SMTP address) to add.Yes-

Examples

Add-MboxAlias -SourceMailbox 'user@contoso.com' -MailboxAlias 'alias@contoso.com'
Add-MboxAlias -Identity 'user@contoso.com' -MailboxAlias 'alias@contoso.com'

Add-MboxPermission

Grant mailbox permissions.

Syntax

Add-MboxPermission -SourceMailbox <String> -UserMailbox <String[]> [-AccessRights <String>] [-AutoMapping] [-PassThru]
ParameterTypeDescriptionRequiredDefault
SourceMailbox (Identity)StringTarget mailbox.Yes-
UserMailboxString[]One or more principals to grant. Pipeline accepted.Yes-
AccessRightsStringRights: All, FullAccess, SendAs, SendOnBehalfTo.NoAll
AutoMappingSwitchEnable/disable Outlook automapping.NoFalse
PassThruSwitchEmit detailed permission objects (default shows only confirmation messages).NoFalse

Examples

Add-MboxPermission -SourceMailbox 'sharedmailbox@contoso.com' -UserMailbox 'user@contoso.com' -AccessRights FullAccess -AutoMapping:$false
Add-MboxPermission -SourceMailbox 'sharedmailbox@contoso.com' -UserMailbox 'user@contoso.com' -PassThru

Export-MboxAlias

Export aliases for auditing.

Syntax

Export-MboxAlias [-SourceMailbox <String[]>] [-Csv] [-CsvFolder <String>] [-All] [-Domain <String>]
ParameterTypeDescriptionRequiredDefault
SourceMailbox (Identity)String[]Target mailbox/recipient. Pipeline accepted.No-
CsvSwitchExport results to CSV.NoFalse
CsvFolderStringDestination folder for CSV export.No-
AllSwitchExport aliases for all non-guest recipients.NoFalse
DomainStringExport aliases for recipients matching a domain.No-

Examples

Export-MboxAlias -SourceMailbox 'user@contoso.com'
Export-MboxAlias -All -CsvFolder 'C:\Temp'

Export-MboxPermission

Export mailbox permissions to CSV.

Syntax

Export-MboxPermission -RecipientType <String> [-CsvFolder <String>]
ParameterTypeDescriptionRequiredDefault
RecipientTypeStringMailbox scope: User, Shared, Room, All.Yes-
CsvFolderStringDestination folder for CSV export.No-

Examples

Export-MboxPermission -RecipientType Shared -CsvFolder 'C:\Temp'
Export-MboxPermission -RecipientType All -CsvFolder 'C:\Temp'

Get-MboxAlias

List aliases for auditing.

Syntax

Get-MboxAlias -Identity <String>
ParameterTypeDescriptionRequiredDefault
IdentityStringTarget mailbox/recipient.Yes-

Examples

Get-MboxAlias -Identity 'user@contoso.com'

Get-MboxLastMessageTrace

Return the most recent received and sent message traces for a mailbox.

Syntax

Get-MboxLastMessageTrace -SourceMailbox <String> [-IncludeTrace]
ParameterTypeDescriptionRequiredDefault
SourceMailbox (Identity)StringTarget mailbox/recipient. Pipeline accepted.No-
IncludeTraceSwitchInclude raw message trace objects in the output.NoFalse

Example

Get-MboxLastMessageTrace -SourceMailbox 'user@contoso.com'
Get-MboxLastMessageTrace -SourceMailbox 'user@contoso.com' -IncludeTrace

Get-MboxPermission

List mailbox permissions.

Syntax

Get-MboxPermission -Identity <String>
ParameterTypeDescriptionRequiredDefault
IdentityStringTarget mailbox.Yes-

Examples

Get-MboxPermission -Identity 'sharedmailbox@contoso.com'

Get-MboxPrimarySmtpAddress

Return the PrimarySmtpAddress for a mailbox or recipient.

Syntax

Get-MboxPrimarySmtpAddress -SourceMailbox <String[]> [-Raw] [-Detailed]
ParameterTypeDescriptionRequiredDefault
SourceMailbox (Identity)String[]Target mailbox/recipient. Pipeline accepted.Yes-
RawSwitchReturn only the PrimarySmtpAddress values.NoFalse
DetailedSwitchInclude additional fields (Identity, RecipientTypeDetails).NoFalse
tip

Get-MboxPrimarySmtpAddress is also available as gpa (alias).

By default, object output is compact and optimized for console readability:

  • DisplayName
  • PrimarySmtpAddress

Example

Get-MboxPrimarySmtpAddress -SourceMailbox 'user@contoso.com'
Get-MboxPrimarySmtpAddress -SourceMailbox 'user@contoso.com' -Raw
gpa 'user@contoso.com' -Raw
Get-MboxPrimarySmtpAddress -SourceMailbox 'user@contoso.com' -Detailed

Get-UserLastSeen

Return the most recent activity for a mailbox combining Exchange LastUserActionTime and (when available) Entra ID sign-in logs.

Syntax

Get-UserLastSeen -User <String>
ParameterTypeDescriptionRequiredDefault
User (Identity, UserPrincipalName)StringTarget mailbox identity. Pipeline accepted.No-

Example

Get-UserLastSeen -User 'user@contoso.com'

Notes:

  • Requires Exchange Online connection. Graph sign-in logs are included when AuditLog.Read.All + Directory.Read.All scopes are available.
  • Output includes LastUserActionTime, LastInteractiveSignIn, LastSeen, and the Source used.

New-SharedMailbox

Create a shared mailbox.

Syntax

New-SharedMailbox -SharedMailboxSMTPAddress <String> -SharedMailboxDisplayName <String> -SharedMailboxAlias <String>
ParameterTypeDescriptionRequiredDefault
SharedMailboxSMTPAddressStringPrimary SMTP address of the new shared mailbox.Yes-
SharedMailboxDisplayNameStringDisplay name.Yes-
SharedMailboxAliasStringMail alias.Yes-

Example

New-SharedMailbox -SharedMailboxSMTPAddress 'sharedmailbox@contoso.com' -SharedMailboxDisplayName 'Support Team' -SharedMailboxAlias 'SupportTeam'

Remove-MboxAlias

Remove SMTP aliases from a recipient.

Syntax

Remove-MboxAlias -SourceMailbox <String> -MailboxAlias <String>
ParameterTypeDescriptionRequiredDefault
SourceMailbox (Identity)StringTarget mailbox/recipient. Pipeline accepted.Yes-
MailboxAliasStringAlias (SMTP address) to remove.Yes-

Examples

Remove-MboxAlias -SourceMailbox 'user@contoso.com' -MailboxAlias 'alias@contoso.com'

Remove-MboxPermission

Revoke mailbox permissions.

Syntax

Remove-MboxPermission -SourceMailbox <String> -UserMailbox <String[]> [-AccessRights <String>]
Remove-MboxPermission -SourceMailbox <String> -ClearAll
Remove-MboxPermission <SourceMailbox> <UserMailbox> [-AccessRights <String>]
ParameterTypeDescriptionRequiredDefault
SourceMailbox (Identity)StringTarget mailbox.Yes-
UserMailboxString[]Principal(s) to revoke.Yes (User mode)-
AccessRightsStringRights (e.g., FullAccess, SendAs, SendOnBehalfTo). Defaults to All.NoAll
ClearAllSwitchRemove all non-inherited FullAccess, SendAs, and SendOnBehalfTo permissions from the source mailbox.Yes (All mode)-

Examples

Remove-MboxPermission -SourceMailbox 'sharedmailbox@contoso.com' -UserMailbox 'user@contoso.com' -AccessRights FullAccess
# Positional call (SourceMailbox = position 0, UserMailbox = position 1)
Remove-MboxPermission 'sharedmailbox@contoso.com' 'user@contoso.com'
Remove-MboxPermission -SourceMailbox 'sharedmailbox@contoso.com' -ClearAll

Set-MboxLanguage

Set mailbox UI language and regional defaults.

Syntax

Set-MboxLanguage -SourceMailbox <String[]> [-Language <String>]
Set-MboxLanguage -Csv <String> [-Language <String>]
ParameterTypeDescriptionRequiredDefault
SourceMailbox (Identity)String[]Target mailbox(es). Pipeline accepted.No-
CsvStringCSV file path containing EmailAddress column.No-
LanguageStringCulture code (e.g., it-IT, en-US).Noit-IT

Example

Set-MboxLanguage -SourceMailbox 'user@contoso.com' -Language it-IT
Set-MboxLanguage -Csv 'C:\Temp\mailboxes.csv' -Language en-US

Set-MboxRulesQuota

Set rules quota to 256KB for one or more mailboxes.

Syntax

Set-MboxRulesQuota -SourceMailbox <String[]>
ParameterTypeDescriptionRequiredDefault
SourceMailbox (Identity)String[]Target mailbox(es). Pipeline accepted.No-

Example

Set-MboxRulesQuota -SourceMailbox 'user@contoso.com','sharedmailbox@contoso.com'

Set-SharedMboxCopyForSent

Enable sent-item copy settings for shared mailboxes.

Syntax

Set-SharedMboxCopyForSent -SourceMailbox <String[]>
ParameterTypeDescriptionRequiredDefault
SourceMailbox (Identity)String[]Shared mailbox(es). Pipeline accepted.Yes-

Example

Set-SharedMboxCopyForSent -SourceMailbox 'sharedmailbox@contoso.com'

Test-SharedMailboxCompliance

Report shared mailbox sign-in activity and Exchange Online licensing indicators.

Syntax

Test-SharedMailboxCompliance [-GridView]
ParameterTypeDescriptionRequiredDefault
GridViewSwitchShow output in Out-GridView (default behavior). Use -GridView:$false to return objects.NoTrue

Example

Test-SharedMailboxCompliance