How to Update Mailbox Properties in Exchange Online Using PowerShell


Introduction:
As an Exchange Online administrator, managing mailbox properties is a crucial task that ensures the smooth operation of your organization’s communication infrastructure. Whether you need to update user details, configure mailbox settings, or manage attributes, PowerShell provides a powerful and flexible way to handle these tasks. In this blog, we’ll explore various methods for updating mailbox properties in Exchange Online using PowerShell, complete with detailed explanations and examples.

Prerequisites

Before you begin, ensure you have the following:

  • Exchange Online PowerShell Module installed.
  • Administrative Privileges to manage and update mailbox properties.
  • Connected to Exchange Online PowerShell.

Step 1: Connect to Exchange Online PowerShell

To update mailbox properties, first, connect to Exchange Online PowerShell:

PowerShell
Install-Module -Name ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName your-email@domain.com

Replace your-email@domain.com with your admin email.

Common Mailbox Properties to Update

Exchange Online mailboxes have various properties that you may need to update, such as display names, email aliases, mailbox quotas, and more. Below, we’ll cover some of the most commonly updated properties and provide detailed PowerShell commands for each.

Method 1: Update Display Name

The display name is the name that appears in the Global Address List (GAL) and in the recipient’s inbox. Here’s how to update it:

PowerShell
Set-Mailbox -Identity user@yourdomain.com -DisplayName "Johnathan Doe"

Explanation:

  • Set-Mailbox: Modifies the properties of an existing mailbox.
  • Identity: Specifies the user mailbox to update, typically using the user’s email address.
  • DisplayName: Sets the new display name for the user, in this case, changing “John Doe” to “Johnathan Doe”.

Method 2: Update Primary SMTP Address

The primary SMTP address is the main email address used by the mailbox. Changing this does not affect the user’s ability to receive emails at their previous address if you choose to retain it as an alias:

PowerShell
Set-Mailbox -Identity user@yourdomain.com -PrimarySmtpAddress johnathan.doe@yourdomain.com

Explanation:

  • PrimarySmtpAddress: Sets a new primary email address for the user.

Method 3: Add or Remove Email Aliases

Email aliases allow a user to receive emails at multiple addresses. Here’s how to add or remove aliases:

Add an Alias:

PowerShell
Set-Mailbox -Identity user@yourdomain.com -EmailAddresses @{Add="j.doe@yourdomain.com"}

Remove an Alias:

PowerShell
Set-Mailbox -Identity user@yourdomain.com -EmailAddresses @{Remove="j.doe@yourdomain.com"}

Explanation:

  • EmailAddresses: Specifies the email addresses associated with the mailbox.
  • Add/Remove: Indicates whether to add or remove an alias. Multiple aliases can be added or removed at once by separating them with commas.

Method 4: Update Mailbox Quota

Mailbox quotas control the amount of storage a user can utilize. Adjusting quotas is essential for managing storage resources effectively:

PowerShell
Set-Mailbox -Identity user@yourdomain.com -IssueWarningQuota 45GB -ProhibitSendQuota 48GB -ProhibitSendReceiveQuota 50GB

Explanation:

  • IssueWarningQuota: Specifies the storage limit at which the user will receive a warning.
  • ProhibitSendQuota: Sets the limit at which the user can no longer send emails.
  • ProhibitSendReceiveQuota: Defines the limit at which the user can no longer send or receive emails.

Method 5: Update Mailbox Regional Settings

Mailbox regional settings include the time zone, language, and date format. Updating these settings is important for users in different geographical locations:

PowerShell
Set-MailboxRegionalConfiguration -Identity user@yourdomain.com -Language en-US -TimeZone "Pacific Standard Time" -DateFormat "MM/dd/yyyy" -TimeFormat "hh:mm tt"

Explanation:

  • Set-MailboxRegionalConfiguration: Configures regional settings for the mailbox.
  • Language: Specifies the mailbox’s display language.
  • TimeZone: Sets the time zone.
  • DateFormat/TimeFormat: Defines the format for dates and times in the mailbox.

Method 6: Configure Mailbox Permissions

Managing mailbox permissions is crucial for controlling access. Here’s how to assign or remove permissions:

Assign Full Access Permission:

PowerShell
Add-MailboxPermission -Identity user@yourdomain.com -User anotheruser@yourdomain.com -AccessRights FullAccess -InheritanceType All

Remove Full Access Permission:

PowerShell
Remove-MailboxPermission -Identity user@yourdomain.com -User anotheruser@yourdomain.com -AccessRights FullAccess -InheritanceType All

Explanation:

  • Add-MailboxPermission/Remove-MailboxPermission: Adds or removes permissions for a mailbox.
  • AccessRights: Specifies the type of access (e.g., FullAccess allows full control over the mailbox).

Method 7: Update Custom Attributes

Custom attributes allow you to store additional information about a mailbox, such as department or job role:

PowerShell
Set-Mailbox -Identity user@yourdomain.com -CustomAttribute1 "Sales Department" -CustomAttribute2 "Manager"

Explanation:

  • CustomAttribute1/2: Custom attributes that can store any text information relevant to the user.

Method 8: Configure Email Forwarding

Email forwarding automatically sends copies of incoming emails to another address. Here’s how to set it up:

PowerShell
Set-Mailbox -Identity user@yourdomain.com -ForwardingSMTPAddress "forwarding@yourdomain.com" -DeliverToMailboxAndForward $true

Explanation:

  • ForwardingSMTPAddress: The email address to which messages will be forwarded.
  • DeliverToMailboxAndForward: If set to $true, emails are delivered to both the original mailbox and the forwarding address.

Step 4: Verifying the Changes

After making changes, it’s important to verify that the mailbox properties have been updated correctly:

PowerShell
Get-Mailbox -Identity user@yourdomain.com | Format-List DisplayName, PrimarySmtpAddress, EmailAddresses, IssueWarningQuota, ProhibitSendQuota, ProhibitSendReceiveQuota

Explanation:

  • Format-List: Formats the output to display the specified properties of the mailbox.

Best Practices for Updating Mailbox Properties

  1. Test in a Lab Environment:
  • Before making changes in a production environment, test your PowerShell scripts in a lab environment to ensure they work as expected.
  1. Document Changes:
  • Keep a log of all changes made to mailbox properties, including the reasons for the updates and the methods used. This can be helpful for audits and troubleshooting.
  1. Communicate with Users:
  • Inform users of any changes to their mailboxes, especially if those changes might impact their day-to-day operations, such as quota adjustments or permission changes.

Conclusion

Updating mailbox properties in Exchange Online is a routine yet critical task for administrators. PowerShell offers a flexible and powerful way to manage these updates, ensuring that your organization’s communication infrastructure runs smoothly. By following the steps outlined in this guide, you can efficiently manage and customize mailbox properties to meet your organization’s needs.

Stay tuned for more PowerShell tutorials and Exchange Online management tips in our upcoming blogs!