Although the trend in recent years is towards larger and larger mailboxes there are still many organizations that set mailbox quotas for their Exchange users. I do actually recommend setting mailbox quotas in just about every organization anyway, because “unlimited” can be dangerous from a capacity management perspective if left unmonitored. A very large quota that is effectively “unlimited” is better, in my opinion.

In some operational roles where I’ve worked and where quotas were in use there was a fairly regular requirement to bump up a specific mailbox user’s quota. Often the request was worded as “Can you add 10% to Adam Wally’s mailbox quotas.”

There’s two administrative challenges with that request, although they are relatively minor:

  • You need to calculate what the new quotas should be ($currentquota + 10%) for each of the IssueWarningQuota, ProhibitSendQuota, and ProhibitSendReceiveQuota settings.
  • You need to navigate through the Exchange Admin Center or run a long-ish PowerShell command to set the new values.
  • If the request is for more than one user, the above tasks are very repetitive and time-consuming.

Set-MailboxQuota.ps1 is a PowerShell script written to solve those problems. This script can be run against a single mailbox, or multiple mailboxes. There are three options when running the script:

  • Set the mailbox to use the default quota thresholds configured on the mailbox database
  • Increase each of the mailbox quotas by a specified percentage
  • Decrease each of the mailbox quotas by a specific percentage

Examples:

This command will set Alannah Shaw’s mailbox to use the default quotas that are configured on the database hosting their mailbox.

[PS] C:\Scripts>.\Set-MailboxQuota.ps1 -Mailbox Alannah.Shaw -UseDatabaseDefaults
----------------------------------------
Mailbox: Alannah Shaw
----------------------------------------

Uses Database Defaults: False

Warning Quota: 1.88 GB (2,019,086,336 bytes)
Prohibit Send Quota: 1.98 GB (2,126,010,368 bytes)
Prohibit Send/Receive Quota: 2.277 GB (2,444,702,720 bytes)

Alannah Shaw has been configured to use database quota defaults.
----------------------------------------

This command will increase Alannah Shaw’s mailbox quota values by 10%.

[PS] C:\Scripts>.\Set-MailboxQuota.ps1 -Mailbox Alannah.Shaw -IncreaseByPercentage 10
----------------------------------------
Mailbox: Alannah Shaw
----------------------------------------

Uses Database Defaults: True

Warning Quota: 1.899 GB (2,039,480,320 bytes)
Prohibit Send Quota: 2 GB (2,147,483,648 bytes)
Prohibit Send/Receive Quota: 2.3 GB (2,469,396,480 bytes)

Calculating new quotas
Current warning quota: 1991680 KB
New warning quota: 2190848 KB
Current send quota: 2097152 KB
New send quota: 2306867.2 KB
Current send/rec quota: 2411520 KB
New send/rec quota: 2652672 KB
Setting new quotas
Quotas increased by 10 percent
----------------------------------------

This command will set all mailboxes on database DB01 to use the default quota values configured on the database.

[PS] C:\Scripts>Get-Mailbox -Database DB01 | .\Set-MailboxQuota.ps1 -UseDatabaseDefaults

if any of the current quota levels for the mailbox user or the database they’re hosted on are set to “Unlimited” the script will not make any changes to the mailbox.

Set-MailboxQuota.ps1 is available for download from the TechNet Script Gallery and Github. Comments are welcome below.

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Garrett

    if i wanted to do something for a group of mailboxes where they are not using the default database size so im setting the quota in the script what would be the best way to go around that all the mailboxes in question use the same reference-user

    great script I follow your site a lot

  2. Hemachandran

    The script gives me the error “WARNING: You cannot call a method on a null-valued expression.” when any of the mailbox settings is configured as unlimited. e.g. we have many user mail boxes where prohibit receive is configured unlimited and other settings like warning is configured to specific no. Since we enabled online archive i want to reset the mailbox specific settings to database defaults. But gives me above error on the mailboxes where i have any quota settings set as unlimited.

  3. sanju

    How can we override the mailbox setting of unlimited quota option on each database ? I have users in a DB that are manually set to unlimted quotas and I need to reset them to mailbox defaults.

  4. Algar

    Hi,

    Can you increase the following property? If yes how? Thanks!
    DatabaseIssueWarningQuota : 48.2 GB (51,754,356,736 bytes)
    DatabaseProhibitSendQuota : 50 GB (53,687,091,200 bytes)
    DatabaseProhibitSendReceiveQuota : 51 GB (54,760,833,024 bytes)

    1. Paul Cunningham

      Yes, that’s what the script does. Or you can just do it with the Set-Mailbox cmdlet on its own.

  5. Zanzibarjones

    How would I go about increasing quotas by percentage based on the current mailbox size instead of the current quota?

    1. Paul Cunningham

      Write some code that pulls the current size of the mailbox and base the increase off that. You can get current size from the results of Get-MailboxStatistics.

  6. Andreas

    Cool Skript, but if i like to change User that habe one value as unlimited (for me, all Users [Send/Receive quota]), noch changes will done.

  7. Mathew

    Is there any way we can look for mailboxes reaching 90-95 % to the quota defined and increase this for only those users by n % .

    1. Paul Cunningham

      Yes. You can use Get-MailboxStatistics to pull the current size of the mailbox, compare it to the applicable quota, and run your logic based on that.

  8. David

    The concept of this script is exactly what I was looking for. Unfortunately, I get the following when running:

    [PS] C:scripts>.Set-MailboxQuota.ps1 -Mailbox david -IncreaseByPercentage 10
    —————————————-
    Mailbox: David Fletcher
    —————————————-

    Uses Database Defaults: True

    Warning Quota:
    Prohibit Send Quota:
    Prohibit Send/Receive Quota:

    WARNING: You cannot call a method on a null-valued expression.

    I am running this against Exchange 2010 SP3 RU11.

      1. David

        That was from the Exchange Management Shell. I get the same behaviour running the management shell as Administrator as well.

Leave a Reply