Top 50 Exchange Online Mailbox Management Command for Admins

As an administrator, managing Exchange Online mailboxes can be a key responsibility. PowerShell provides a robust set of commands to manage Exchange Online mailboxes. In this article, we will go through exchange online mailbox management command for managing Exchange Online mailboxes.

Exchange Online Mailbox Management Command

**********************************************************************************

Here are the list of exchange online mailbox management command

  1. Connect to Exchange Online: Before you can run any Exchange Online PowerShell commands, you need to connect to your Exchange Online organization using the following command:

Replace <UPN> with the user principal name of the account that has permission to manage Exchange Online.

  • Connect-ExchangeOnline -UserPrincipalName <UPN>
  1. Get Mailbox Information: To get information about a specific mailbox, use the following command:
  • Get-Mailbox -Identity <UserEmail>

Replace <UserEmail> with the email address of the mailbox you want to get information for.

  1. Get Mailbox Statistics: To get statistics for a specific mailbox, use the following command:
  • Get-MailboxStatistics -Identity <UserEmail>

Replace <UserEmail> with the email address of the mailbox you want to get statistics for.

  1. Get Mailbox Permissions: To get a list of permissions for a specific mailbox, use the following command:
  • Get-MailboxPermission -Identity <UserEmail>

Replace <UserEmail> with the email address of the mailbox you want to get permissions for.

  1. Remove Mailbox Permissions: To remove a specific permission from a mailbox, use the following command:
  • Remove-MailboxPermission -Identity <UserEmail> -User <UserName> -AccessRights <Permission>

Replace <UserEmail> with the email address of the mailbox, <UserName> with the name of the user you want to remove the permission for, and <Permission> with the specific permission you want to remove.

  1. Set Mailbox Quota: To set a mailbox quota for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -ProhibitSendQuota <Size> -ProhibitSendReceiveQuota <Size> -IssueWarningQuota <Size>

Replace <UserEmail> with the email address of the mailbox, and <Size> with the desired quota size (e.g. 1GB, 2GB, etc.).

  1. Disable Mailbox: To disable a specific mailbox, use the following command:
  • Disable-Mailbox -Identity <UserEmail>

Replace <UserEmail> with the email address of the mailbox you want to disable.

  1. Enable Mailbox: To enable a disabled mailbox, use the following command:
  • Enable-Mailbox -Identity <UserEmail> -Alias <Alias> -PrimarySmtpAddress <EmailAddress>

Replace <UserEmail> with the email address of the mailbox you want to enable, and <Alias> and <EmailAddress> with the desired values for the mailbox alias and primary SMTP address.

These are just a few of the many PowerShell commands available for managing Exchange Online mailboxes.

  1. Set Mailbox Retention Policy: To set a retention policy for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -RetentionPolicy <PolicyName>

Replace <UserEmail> with the email address of the mailbox, and <PolicyName> with the name of the retention policy you want to apply.

  1. Get Mailbox Folder Permissions: To get a list of permissions for a specific mailbox folder, use the following command:
  • Get-MailboxFolderPermission -Identity <UserEmail>:\<FolderName>

Replace <UserEmail> with the email address of the mailbox, and <FolderName> with the name of the folder you want to get permissions for.

  1. Add Mailbox Folder Permission: To add a specific permission to a mailbox folder, use the following command:
  • Add-MailboxFolderPermission -Identity <UserEmail>:\<FolderName> -User <UserName> -AccessRights <Permission> -InheritanceType <InheritanceType>

Replace <UserEmail> with the email address of the mailbox, <FolderName> with the name of the folder you want to add permissions for, <UserName> with the name of the user you want to add the permission for, <Permission> with the specific permission you want to add, and <InheritanceType> with the type of inheritance you want to apply.

  1. Set Mailbox Litigation Hold: To set litigation hold for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -LitigationHoldEnabled $true -LitigationHoldDuration <Duration>

Replace <UserEmail> with the email address of the mailbox, and <Duration> with the duration you want to set for the litigation hold.

  1. Get Mailbox Forwarding: To get the forwarding settings for a specific mailbox, use the following command:
  • Get-Mailbox -Identity <UserEmail> | select ForwardingSmtpAddress, DeliverToMailboxAndForward

Replace <UserEmail> with the email address of the mailbox you want to get forwarding settings for.

  1. Set Mailbox Forwarding: To set forwarding for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -ForwardingSmtpAddress <EmailAddress> -DeliverToMailboxAndForward $false

Replace <UserEmail> with the email address of the mailbox you want to set forwarding for, and <EmailAddress> with the email address you want to forward the messages to.

  1. Get Mailbox Calendar Permissions: To get a list of permissions for a specific mailbox calendar, use the following command:
  • Get-MailboxFolderPermission -Identity <UserEmail>:\Calendar

Replace <UserEmail> with the email address of the mailbox you want to get calendar permissions for.

  1. Add Mailbox Calendar Permission: To add a specific permission to a mailbox calendar, use the following command:
  • Add-MailboxFolderPermission -Identity <UserEmail>:\Calendar -User <UserName> -AccessRights <Permission> -InheritanceType <InheritanceType>

Replace <UserEmail> with the email address of the mailbox you want to add calendar permissions for, <UserName> with the name of the user you want to add the permission for, <Permission> with the specific permission you want to add, and <InheritanceType> with the type of inheritance you want to apply.

  1. Remove Mailbox Calendar Permission: To remove a specific permission from a mailbox calendar, use the following command:
  • Remove-MailboxFolderPermission -Identity <UserEmail>:\Calendar -User <UserName> -AccessRights <Permission>

Replace <UserEmail> with the email address of the mailbox you want to remove calendar permissions from, <UserName> with the name of the user you want to remove the permission for, and <Permission> with the specific permission you want to remove.

  1. Set Mailbox AutoReply: To set an automatic reply for a specific mailbox, use the following command:
  • Set-MailboxAutoReplyConfiguration -Identity <UserEmail> -AutoReplyState Scheduled -StartTime <StartDate> -EndTime <EndDate> -InternalMessage <InternalMessage> -ExternalMessage <ExternalMessage>

Replace <UserEmail> with the email address of the mailbox you want to set the automatic reply for, <StartDate> with the start date for the automatic reply, <EndDate> with the end date for the automatic reply, <InternalMessage> with the message you want to send to internal recipients, and <ExternalMessage> with the message you want to send to external recipients.

  1. Get Mailbox Permissions: To get a list of permissions for a specific mailbox, use the following command:
  • Get-MailboxPermission -Identity <UserEmail>

Replace <UserEmail> with the email address of the mailbox you want to get permissions for.

  1. Add Mailbox Permission: To add a specific permission to a mailbox, use the following command:
  • Add-MailboxPermission -Identity <UserEmail> -User <UserName> -AccessRights <Permission> -InheritanceType <InheritanceType>

Replace <UserEmail> with the email address of the mailbox you want to add permissions for, <UserName> with the name of the user you want to add the permission for, <Permission> with the specific permission you want to add, and <InheritanceType> with the type of inheritance you want to apply.

  1. Remove Mailbox Permission: To remove a specific permission from a mailbox, use the following command:
  • Remove-MailboxPermission -Identity <UserEmail> -User <UserName> -AccessRights <Permission>

Replace <UserEmail> with the email address of the mailbox you want to remove permissions from, <UserName> with the name of the user you want to remove the permission for, and <Permission> with the specific permission you want to remove.

  1. Get Mailbox Size: To get the size of a specific mailbox, use the following command:
  • Get-MailboxStatistics -Identity <UserEmail> | Select-Object TotalItemSize

Replace <UserEmail> with the email address of the mailbox you want to get the size of.

  1. Get Mailbox Folder Size: To get the size of a specific folder in a mailbox, use the following command:
  • Get-MailboxFolderStatistics -Identity <UserEmail> -FolderScope <FolderScope> | Select-Object FolderPath, ItemsInFolder, FolderSize

Replace <UserEmail> with the email address of the mailbox you want to get the folder size for, and <FolderScope> with the specific folder you want to get the size of.

  1. Export Mailbox to PST: To export a specific mailbox to a PST file, use the following command:
  • New-MailboxExportRequest -Mailbox <UserEmail> -FilePath <FilePath>

Replace <UserEmail> with the email address of the mailbox you want to export, and <FilePath> with the path and file name where you want to save the PST file.

  1. Import Mailbox from PST: To import a specific mailbox from a PST file, use the following command:
  • New-MailboxImportRequest -Mailbox <UserEmail> -FilePath <FilePath> -TargetRootFolder <TargetFolder>

Replace <UserEmail> with the email address of the mailbox you want to import, <FilePath> with the path and file name of the PST file, and <TargetFolder> with the target folder for the imported mailbox data.

  1. Get Mailbox Permissions for Specific User: To get a list of mailboxes that a specific user has permissions to, use the following command:
  • Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission -User <UserName>

Replace <UserName> with the name of the user you want to check for mailbox permissions.

  1. Get Shared Mailboxes: To get a list of all shared mailboxes in your organization, use the following command:
  • Get-Mailbox -ResultSize Unlimited | Where-Object {$_.RecipientTypeDetails -eq “SharedMailbox”}

This command uses the Where-Object cmdlet to filter the results and only return mailboxes where the RecipientTypeDetails property is set to “SharedMailbox”.

  1. Convert User Mailbox to Shared Mailbox: To convert a user mailbox to a shared mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -Type Shared

Replace <UserEmail> with the email address of the mailbox you want to convert.

  1. Convert Shared Mailbox to User Mailbox: To convert a shared mailbox to a user mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -Type Regular

Replace <UserEmail> with the email address of the shared mailbox you want to convert.

  1. Set Mailbox Retention Policy: To set a retention policy for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -RetentionPolicy <PolicyName>

Replace <UserEmail> with the email address of the mailbox you want to set the retention policy for, and <PolicyName> with the name of the retention policy you want to apply.

  1. Set Mailbox Language: To set the language for a specific mailbox, use the following command:
  • Set-MailboxRegionalConfiguration -Identity <UserEmail> -Language <LanguageCode>

Replace <UserEmail> with the email address of the mailbox you want to set the language for, and <LanguageCode> with the code for the language you want to set (e.g. en-US for English).

  1. Get Mailbox Audit Logs: To get a list of mailbox audit logs for a specific mailbox, use the following command:
  • Search-MailboxAuditLog -Identity <UserEmail> -LogonTypes <LogonTypes> -ShowDetails

Replace <UserEmail> with the email address of the mailbox you want to check the audit logs for, and <LogonTypes> with the types of logons you want to include in the results (e.g. Owner, Delegate, Admin).

  1. Set Mailbox Message Delivery Restrictions: To set message delivery restrictions for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -AcceptMessagesOnlyFrom <Senders> -RejectMessagesFrom <Senders> -RequireSenderAuthenticationEnabled $true

Replace <UserEmail> with the email address of the mailbox you want to set the message delivery restrictions for, <Senders> with the email addresses of the senders you want to accept or reject messages from, and $true with $false if you don’t want to require sender authentication.

  1. Get Mailbox Forwarding Rules: To get a list of forwarding rules set up for a specific mailbox, use the following command:
  • Get-Mailbox -Identity <UserEmail> | Get-MailboxForwardingRule

Replace <UserEmail> with the email address of the mailbox you want to check the forwarding rules for.

  1. Set Mailbox Automatic Replies: To set up automatic replies for a specific mailbox, use the following command:
  • Set-MailboxAutoReplyConfiguration -Identity <UserEmail> -AutoReplyState <State> -InternalMessage <InternalMessage> -ExternalMessage <ExternalMessage>

Replace <UserEmail> with the email address of the mailbox you want to set up automatic replies for, <State> with Enabled or Disabled to turn the automatic replies on or off, <InternalMessage> with the message you want to send to internal recipients, and <ExternalMessage> with the message you want to send to external recipients.

  1. Export Mailbox to PST: To export a mailbox to a PST file, use the following command:
  • New-MailboxExportRequest -Mailbox <UserEmail> -FilePath <FilePath>

Replace <UserEmail> with the email address of the mailbox you want to export, and <FilePath> with the path to the folder where you want to save the PST file.

  1. Import PST File to Mailbox: To import a PST file to a mailbox, use the following command:
  • New-MailboxImportRequest -Mailbox <UserEmail> -FilePath <FilePath>

Replace <UserEmail> with the email address of the mailbox you want to import the PST file to, and <FilePath> with the path to the PST file you want to import.

  1. Remove Exchange Online License from Mailbox: To remove an Exchange Online license from a mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -RemoveLicense “<LicenseName>”

Replace <UserEmail> with the email address of the mailbox you want to remove the license from, and <LicenseName> with the name of the license you want to remove (e.g. EXO_PLAN1).

  1. Add Additional SMTP Addresses to Mailbox: To add additional SMTP addresses to a mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -EmailAddresses @{add=”<SMTPAddress1>”, “<SMTPAddress2>”}

Replace <UserEmail> with the email address of the mailbox you want to add SMTP addresses to, <SMTPAddress1> and <SMTPAddress2> with the additional SMTP addresses you want to add.

  1. Get Mailbox Size and Item Count: To get the size and item count for a specific mailbox, use the following command:
  • Get-MailboxStatistics -Identity <UserEmail> | Select-Object DisplayName, TotalItemSize, ItemCount

Replace <UserEmail> with the email address of the mailbox you want to get the size and item count for.

  1. Convert Mailbox to Shared Mailbox: To convert a user mailbox to a shared mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -Type Shared

Replace <UserEmail> with the email address of the mailbox you want to convert.

  1. Set Mailbox Permissions: To set mailbox permissions for a specific mailbox, use the following command:
  • Add-MailboxPermission -Identity <UserEmail> -User <UserOrGroup> -AccessRights <AccessRights>

Replace <UserEmail> with the email address of the mailbox you want to set permissions for, <UserOrGroup> with the user or group you want to grant permissions to, and <AccessRights> with the specific permissions you want to grant (e.g. FullAccess, SendAs, SendOnBehalf).

  1. Disable Mailbox Auto-Mapping: To disable mailbox auto-mapping for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -Automapping $false

Replace <UserEmail> with the email address of the mailbox you want to disable auto-mapping for.

  1. Set Mailbox Retention Policy: To set a retention policy for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -RetentionPolicy “<PolicyName>”

Replace <UserEmail> with the email address of the mailbox you want to set the retention policy for, and <PolicyName> with the name of the retention policy you want to apply.

  1. Get Mailbox Permissions Report: To generate a report of mailbox permissions for all mailboxes in your organization, use the following command:
  • Get-MailboxPermission -ResultSize Unlimited | Select-Object Identity, User, AccessRights | Export-CSV <FilePath>

Replace <FilePath> with the path to the CSV file you want to export the report to.

  1. Disable Forwarding for Mailbox: To disable forwarding for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -ForwardingSmtpAddress $null -DeliverToMailboxAndForward $false

Replace <UserEmail> with the email address of the mailbox you want to disable forwarding for.

  1. Set Mailbox Language: To set the language for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -Language “<LanguageCode>”

Replace <UserEmail> with the email address of the mailbox you want to set the language for, and <LanguageCode> with the language code you want to set (e.g. en-US for English).

  1. Set Mailbox Time Zone: To set the time zone for a specific mailbox, use the following command:
  • Set-MailboxRegionalConfiguration -Identity <UserEmail> -TimeZone “<TimeZone>”

Replace <UserEmail> with the email address of the mailbox you want to set the time zone for, and <TimeZone> with the time zone you want to set (e.g. Pacific Standard Time).

  1. Disable Archive Mailbox: To disable the archive mailbox for a specific mailbox, use the following command:
  • Disable-Mailbox -Identity <UserEmail> -Archive

Replace <UserEmail> with the email address of the mailbox you want to disable the archive mailbox for.

  1. Set Mailbox Forwarding Address: To set a forwarding address for a specific mailbox, use the following command:
  • Set-Mailbox -Identity <UserEmail> -ForwardingSmtpAddress “<ForwardingEmail>”

Replace <UserEmail> with the email address of the mailbox you want to set the forwarding address for, and <ForwardingEmail> with the email address you want to forward the mailbox to.

I hope you find these additional PowerShell commands for managing Exchange Online mailboxes helpful!

Top 50 Exchange Online Mailbox Management Command for Admins


Discover more from Empowering Your Learning Journey

Subscribe to get the latest posts to your email.

Discover more from Empowering Your Learning Journey

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top