Limit Exchange 2010 Email Attachment Size for users with PowerShell.

Recently had a request to limit the email attachment size for specific users within the Exchange Organization. The following one line script took care of the request:

New-TransportRule -Name 'Attachment Size Limit' -Comments '' -Priority '0' -Enabled $true -FromMemberOf '' -SentToScope 'NotInOrganization' -AttachmentSizeOver '300 KB (307,200 bytes)' -RejectMessageReasonText 'Sorry, your attachment exceeds the limit of 300KB.' -RejectMessageEnhancedStatusCode '5.7.666'

Quick breakdown of the script:

1) I created a distribution group.

2) Added the required users to the group.

3) Did some quick research and decided on using the New-TransportRule cmdlet to achieve the objective.

4) Set the AttachmentSizeOver parameter to the requested value of 300KB, the SentToScope is set to NotInOrganization (only emails sent Outside the organization) and all other parameter values are set as indicated in the script.

You can also use the New-SystemMessage cmdlet to create new delivery service notifications. The following screen shot shows the result after testing the rule:


This entry was posted in Exchange 2010 SP2, Exchange Cmdlets, Exchange Management Shell, Microsoft Exchange and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s