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.
This article Set-MailboxQuota.ps1 – A PowerShell Script for Configuring Exchange Server Mailbox Quotas is © 2015 ExchangeServerPro.com
Get more Exchange Server tips at ExchangeServerPro.com