Set-Mailbox – Change Mailbox settings with PowerShell

The Set-Mailbox cmdlet in PowerShell allows us to change mailbox settings in Exchange Server and Exchange Online. We can use the cmdlet for example to change mailbox quotas, add an alias to the mailbox, set folder permissions, or even change the mailbox language.

In this article, we are not going to look at all options for this cmdlet, because there are over 180 parameters for the cmdlet. Instead, we will focus on the most common use cases for the Set-Mailbox cmdlet.

Getting started with Set-Mailbox

Before we can use the set-mailbox cmdlet we first need to connect to Exchange Online. Make sure that you have installed the latest PowerShell module and know how to connect to your Exchange server. You can read this guide on how to connect to Exchange Online.

The set-mailbox cmdlet requires atleast the identity of the mailbox that you want to change. And for the identity, we can use a lot of options, but the most useful are:

  • Mailbox name
  • Email address
  • Domain\username
  • SamAccountAnme
  • GUID

So before we are going to make a change to the mailbox it’s a good idea to use the Get-Mailbox cmdlet to verify if you have the correct mailbox:

# Based on email address
Get-Mailbox -Identity [email protected]

# Or based on mailbox name
Get-Mailbox -Identity AdeleV

With the identity verified we can change the mailbox settings, for example, the name of the mailbox:

Set-Mailbox -Identity AdeleV -Name Adelev-test

Change Multiple Mailboxes at Once

PowerShell allows us to pipe cmdlet after each other. So when you need to update a property on multiple mailboxes, we can first get all the users with the correct filter, and then change the mailboxes with the set-mailbox cmdlet.

For example, to get all employees with the job title “Marketing Assistant” we first filter the AzureADUser cmdlet and then update the mailbox setting for each user:

Get-AzureADUser -Filter "jobtitle eq 'Marketing Assistant'" | ForEach {Set-Mailbox -Identity $_.UserPrincipalName -ExtensionCustomAttribute1 "Test"}

If you want to know more about using filters to select users, then make sure you read this article.

Another option to change settings for multiple mailboxes is to first define the identities of the mailboxes in an array and then change the setting for each of them:

("Adelev","LeeG","MeganB") | ForEach  {Set-Mailbox -Identity $_ -ExtensionCustomAttribute1 "Test"}

Set Mailbox Forwarding

Forwarding emails to another user or even to an external email address is quite common. We can use PowerShell and the Set-Mailbox cmdlet to configure it. If you look at the documentation you might have noticed that there are two parameters that you can use for the forwarding:

  • ForwardingAddress
  • ForwardingSmtpAddress

The difference between ForwardingAddress and ForwardingSmtpAddress is that the latter takes any email address (internal or external) to forward the mail to. The first requires a mail-enabled object, which can be a user or group mailbox or contact in your Azure Active Directory.

So to forward emails to another user we can use the following cmdlet:

Set-Mailbox -Identity [email protected] -ForwardingAddress [email protected]

# Or forward the mail from Adele to the info mailbox:
Set-Mailbox -Identity Adelev -ForwardingAddress "info"

To forward the mail to an external mailbox we can use the ForwardingSmtpAddress parameter:

Set-Mailbox -Identity Adelev -ForwardingSmtpAddress [email protected]


By default, the emails will only be delivered to the forwarded email address. But on some occasions, you also want to retain a copy of the mail in the original mailbox. For this, we can use the DeliverToMailboxAndForward parameter:

Set-Mailbox -Identity Adelev -ForwardingAddress "lab 19" -DeliverToMailboxAndForward $true

Set Office 365 Attachment Size Limit

The default attachment size limit for receiving and sending is 35Mb for Office 365. You can however increase this to the office 365 max attachment size of 150Mb.

We will need to change the MaxSendSize limit and MaxReceiveSize limit for this:

Set-Mailbox -Identity Adelev -MaxSendSize 150MB -MaxReceiveSize 150MB

To change the attachment limit on all mailboxes you can use the command below:

Get-Mailbox | Set-Mailbox -Identity Adelev -MaxSendSize 150MB -MaxReceiveSize 150MB

It’s also a good idea to change the default limit for new mailboxes/users. For this we will need to update the mailbox plan settings:

Get-MailboxPlan | Set-MailboxPlan -MaxSendSize 150MB -MaxReceiveSize 150MB

Wrapping Up

There are a lot of settings that you can change with the set-mailbox cmdlet. I can’t explain all options, but hopefully, this helped you to get started with the cmdlet. Other articles you might like are:

If you have any questions, just drop a comment below.

Leave a Comment