Schedule a task to set custom message size for new mailboxes

For instance if you have mailbox users with different message size – like some management users with 20 MB message size and rest all users with 5 MB quota. By default, exchange will set unlimited message size. Unlimited does n’t mean that a user can attach and send any file size. Global transport configuration & send and receive connector configurations will be considered.

We can set a standard message size for all users at once using below command.

Set-User -resultsize unlimited –MaxSendSize 5MB -MaxReceiveSize 5MB

If you wish to set message size for an individual mailbox size then use below command.

Set-User –Identity “UserName” –MaxSendSize 20MB -MaxReceiveSize 20MB

How to set a custom message size for all the mailboxes that you create on a daily basis. It can be configured manually from the mailbox but it can be automated using the task scheduler. Follow the below steps to schedule a task.

We would be using the below command to automate the task. It can be scheduled to run once in a day.

Get-User -Filter “RecipientTypeDetails -eq ‘UserMailbox'” -resultsize unlimited | where {$_.WhenCreated -gt (get-date).adddays(-1)} | Set-Mailbox -MaxSendSize 5mb -MaxReceiveSize 5mb

RecipientTypeDetails -eq ‘UserMailbox’ – This will make sure the command is only applied on User mailboxes.

where {$_.WhenCreated -gt (get-date).adddays(-1)} – This will let you apply this rule on mailboxes created before 1 day.

Create the scheduled task using below parameters:

Enter below command in the Program/script field:


Then inside the Arguments field enter the below.

-command “. ‘C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1’; Connect-ExchangeServer -auto”; C:\MessageSize.ps1


Download this script MessageSize (Download this script and rename it to .ps1)

1 Comment on "Schedule a task to set custom message size for new mailboxes"

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.